Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BridJ generation and OSGI runtime environment #114

Open
IOOOTAlan opened this issue Sep 12, 2017 · 0 comments
Open

BridJ generation and OSGI runtime environment #114

IOOOTAlan opened this issue Sep 12, 2017 · 0 comments

Comments

@IOOOTAlan
Copy link

IOOOTAlan commented Sep 12, 2017

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:

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?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant