jna

JNA updateStructureByReference() trouble

感情迁移 提交于 2019-12-12 00:47:37
问题 this is the first time I am using JNA. What I am trying to do is call a function in a DLL that takes (C code)->(unsigned long DeviceTypes, NeoDevice *pNeoDevice, int *pNumDevices)...(JNA form)-> (int, NeoDevice.getPointer(), int[] myInt) as params. The function should write to the fields of the struct and I want to view the updated fields. here is my JNA struct 'NeoDevice' import java.util.Arrays; import java.util.List; import com.sun.jna.*; public class NeoDevice extends Structure { public

Inconsistent results calling DLL from JNA/C versus Pascal

断了今生、忘了曾经 提交于 2019-12-11 20:44:53
问题 I have a c++ dll library with header files provided, without implementation. And I implement JNA call for this library functions. And I have the problem with only 1 function (other, even similar works fine). This is declaration from .h file: int CALLINGCONV SMIMESignML( const char* pin, unsigned long slot, const char* szOutputFilePath, const char* szFrom, const char* szTo, const char* szSubject, const char* szOtherHeaders, const char* szBody, const char* szAttachments, unsigned long dwFlags,

Running a JNA example with POSIX message queues

孤街醉人 提交于 2019-12-11 19:05:05
问题 I need to communicate a Java application and a C process via POSIX message queue, and I would like to do it using JNA. After some research, reading and your help, I started with a simple Java application which tries to create a message queue. /** Simple example of JNA interface mapping and usage. */ public class HelloJNAWorld { // This is the standard, stable way of mapping, which supports extensive // customization and mapping of Java to native types. public interface IPCLibrary extends

Best choice. Use .Net Dll in Java Application

对着背影说爱祢 提交于 2019-12-11 18:32:27
问题 I know three is some questions about this, but I've not found the exact response. We have a .Net dll (C#) with no dependencies or p/Invoke. So it's a full .net platform library. One of our clientes wants to use it in a Java Application. What's the best choice? I've been looking at jni4net wich could be a perfect solution, but it seems don't support generics in .Net (our dll uses lot of generics dictionaries and collections) It's JNA the best choice? Thanks in advance 回答1: I had a similar

Getting JNA to work with SCO

三世轮回 提交于 2019-12-11 18:29:06
问题 I have a very basic JNA test setup that I want to use to verify whether or not I can use JNA with Java 1.4 on SCO. Yes, this is very much a legacy project. No, I'm required to use these technologies. I've already verified that Java 1.4 is capable of supporting JNA by running it on a local Windows machine, however, when I move things over to a SCO VM I have setup and try to run it there, I get an UnsatisfiedLinkError: jnidispatch (/com/sun/jna/openserver-ia32/libjnidispatch.so) not found in

Calling OpenEvent fails through JNA

試著忘記壹切 提交于 2019-12-11 18:04:54
问题 I am trying to call OpenEvent of kernel32.dll using JNA and it fails with the error java.lang.UnsatisfiedLinkError : Error looking up function 'OpenEvent': The specified procedure could not be found. My stub declaration looks like this public static native Pointer OpenEvent(int access, boolean inheritHandle, String name); Can someone help me identify the issue here? -- After making modification based on users feedback I dont get the error now; but OpenEvent method always returns null. This is

wrong output is coming from Structure filed values in JNA

孤街浪徒 提交于 2019-12-11 14:17:13
问题 I am trying to use the Vector XL Driver Library (vxlapi64.dll) using java code. I created a JNA project to read vxlapi64.dll and mapped data types also, but output is producing wrong values for the elements of the structure. C code structure: typedef struct s_xl_channel_config { char name [XL_MAX_LENGTH + 1]; unsigned char hwType; unsigned char hwIndex; unsigned char hwChannel; unsigned short transceiverType; unsigned short transceiverState; unsigned short configError; unsigned char

Using jna to consume key events

时光总嘲笑我的痴心妄想 提交于 2019-12-11 13:38:42
问题 In one of the applications I am writing i need to consume certain key events so other applications dont process them. In my code i make a com.sun.jna.platform.win32.WinUser.LowLevelKeyboardProc like so: import com.sun.jna.Native; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.WinDef.HMODULE; import com.sun.jna.platform.win32.WinDef.LRESULT; import com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.platform.win32.WinUser.HHOOK; import com.sun.jna

Java JNA read codes sent via window messages

允我心安 提交于 2019-12-11 13:30:44
问题 I need to read codes sent via Windows Messages with Java in a Windows CE device, I'm using JNA but I'm not succeeding with this issue. I've defined the library call: public interface CoreDll extends StdCallLibrary { //loads the coredll with unicode options CoreDll INSTANCE = (CoreDll)Native.loadLibrary("coredll", CoreDll.class, W32APIOptions.UNICODE_OPTIONS); //native calls INT_PTR CreateWindowEx(int dwExStyle, String lpClassName, String lpWindowName, int dwStyle, int x, int y, int width, int

Java JNA FindWindow() - Error looking up function 'FindWindow': The specified procedure could not be found

家住魔仙堡 提交于 2019-12-11 13:18:41
问题 I'm trying to bring to front a window named MyWindowTitle , using JNA . import com.sun.jna.Native; import com.sun.jna.win32.StdCallLibrary; import com.sun.jna.platform.win32.WinDef.HWND; public class ToFront { public static interface User32 extends StdCallLibrary { final User32 instance = (User32) Native.loadLibrary ("user32", User32.class); HWND FindWindow(String winClass, String title); boolean ShowWindow(HWND hWnd, int nCmdShow); boolean SetForegroundWindow(HWND hWnd); } public static void