Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

jni.d inheriting from java interfaces #372

Open
John-Colvin opened this issue Mar 2, 2023 · 1 comment
Open

jni.d inheriting from java interfaces #372

John-Colvin opened this issue Mar 2, 2023 · 1 comment

Comments

@John-Colvin
Copy link
Contributor

Is this possible? Just noticed interfaces and classes are all translated asfinal class 😱 and there's a comment saying

	// so overriding Java classes from D is iffy and with separate implementation
	// non final leads to linker errors anyway...

so maybe this is a genuinely hard problem?

@adamdruppe
Copy link
Owner

I know on Android it was just plain impossible to generate new classes through JNI, so I dropped it, but with regular Java it would be possible, in theory, to generate some Java bytecode that has a stub class forwards to a D class and subclass things that way. But yeah, it is easier said than done.

The best way to use this is to call Java methods from D and then write little Java classes in Java with native methods you implement on the D side. This makes doing things like callbacks a pain since all those delegate classes will need Java stubs.

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

No branches or pull requests

2 participants