S
S
Sergey2017-08-08 15:31:16
Java
Sergey, 2017-08-08 15:31:16

How to pass unsigned int to JNI?

Hello.

I have a library written in C (not by me). It has a method:

HRESULT ZR_Initialize(
UINT nFlags
);

The C# examples use this method like this:
[DllImport(ZrDllName, CallingConvention = CallingConvention.StdCall, EntryPoint = "ZR_Initialize")]
        public static extern int ZR_Initialize(UInt32 nFlags);

I'm trying to do this in Java:
public class ZReader {
    static {
        System.loadLibrary("ZReader");
    }

    native static public int ZR_Initialize(int Flags);
}

But I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: ru.semihal.sdkklientiks.ZReader.ZR_Initialize(I)I

Please tell me how to call this method correctly and what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2017-08-08
@jamakasi666

if the library was not specifically written for JNI, then nothing will come of it. But it will work if you use JNA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question