__stdcall with JNR

275 Views Asked by At

I'm using JNR and trying to call to __stdcall function. I've already tried to load library with stdcall() convention:

mTemplateApi = LibraryLoader.create(FPTemplateAPI.class).stdcall().load("FPTemplateAPI");

And tried to annotate method with @StdCall.

public interface FPTemplateAP  
{
    @StdCall
    Pointer CreateTemplateImage(@In ByteBuffer aTemplate,
                                @Out IntByReference aWidth,
                                @Out IntByReference aHeight,
                                @In boolean aColor);

}

As result I get the following error when I try to call to method:

Exception in thread "main" java.lang.UnsatisfiedLinkError: The operation completed successfully.

at jnr.ffi.provider.jffi.AsmRuntime.newUnsatisifiedLinkError(AsmRuntime.java:40)
1

There are 1 best solutions below

0
goto1134 On

For now I created another dll that delegates to __stdcall dll, but uses __cdecl, and it perfectly works for me.