while using JNAerator with bridj-0.7.0 we had some serious issues in using the code inside an OSGI environment (Eclipse Equinox): our bundle containing the JNAerator-generated code was not able to load because of a NoClassDefFoundError thrown on our main library-loading class.
The problem stemmed from the following static block that is executed as soon as the class is referenced:
static {
BridJ.register();
}
By using the no-args register, the calling class and the relative ClassLoader is inferred in a way that won't work in an OSGI environment.
By simply changing this to use the variant with a Class argument in all of these static blocks we were able to solve the problem:
static {
BridJ.register(MyLibrary.class);
}
Is there a reason for using the no-args method inside the generated static methods?
Would it be possible to change this to at least make it configurable during generation with JNAerator?
Greetings,
while using JNAerator with bridj-0.7.0 we had some serious issues in using the code inside an OSGI environment (Eclipse Equinox): our bundle containing the JNAerator-generated code was not able to load because of a
NoClassDefFoundError
thrown on our main library-loading class. The problem stemmed from the following static block that is executed as soon as the class is referenced:By using the no-args
register
, the calling class and the relative ClassLoader is inferred in a way that won't work in an OSGI environment. By simply changing this to use the variant with a Class argument in all of these static blocks we were able to solve the problem:Is there a reason for using the no-args method inside the generated static methods? Would it be possible to change this to at least make it configurable during generation with JNAerator?