I am trying to use jnaerator for the QCam library (used to control QImaging cameras).
I'm using jnaerator to produce a bundled Jar file with the bridJ option:
java -jar jnaerator-0.12-SNAPSHOT-20130323-2.jar -v -convertBodies -jar QCam.jar -direct -library QCam -mode StandaloneJar CHeaders/*.h libQCam.dylib
It produces this java file (redacted version shown):
@Library("QCam")
@runtime(CRuntime.class)
public class QCamLibrary {
/**
* QCam_LoadDriver()
* Result:
* QCam_Err code<br>
* Original signature : <code>QCam_Err QCam_LoadDriver()</code><br>
* <i>native declaration : CHeaders/QCamApi.h:785</i>
*/
@Convention(Convention.Style.StdCall)
public static IntValuedEnum<QCamLibrary.QCam_Err > QCam_LoadDriver() {
return FlagSet.fromValue(QCam_LoadDriver$2(), QCamLibrary.QCam_Err.class);
}
@Convention(Convention.Style.StdCall)
@Name("QCam_LoadDriver")
protected native static int QCam_LoadDriver$2();
}
When using this with Eclipse with a test program to use this QCam.jar I get an unsatisfied link error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: qcam.QCamLibrary.QCam_LoadDriver$2()I
at qcam.QCamLibrary.QCam_LoadDriver$2(Native Method)
at qcam.QCamLibrary.QCam_LoadDriver(QCamLibrary.java:1010)
at TestQCam.main(TestQCam.java:47)
The dynamic library is being loaded. All works well if I duplicate the QCamLibrary and change it to:
@Convention(Convention.Style.StdCall)
public static IntValuedEnum<QCamLibrary2.QCam_Err > QCam_LoadDriverNew() {
return FlagSet.fromValue(QCam_LoadDriver(), QCamLibrary2.QCam_Err.class);
}
@Convention(Convention.Style.StdCall)
protected native static int QCam_LoadDriver();
I presume the @name annotation is being used because since QCam_LoadDriver takes no parameters there is no way to disambiguate the overloaded variant that returns the enum and the native version (returning int) based on function signature. However it looks as if the @name annotation is not being honoured!
But how can I get around this problem? I want to just use the jnaerated QCam,jar version
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4