DLL jni Java6 update 1
Robert Fraser
fraserofthenight at gmail.com
Thu Mar 13 06:22:04 PDT 2008
Christoph wrote:
> Hi All!
>
> Ich have a problem with jni and Java6 update 1.
> I have follwing files
>
> my.dll (DMD, bud)
> myjni.dll (SWIGm, dmc or bcc32) references my.dll
>
> When I am using Java5 everthing runs fine.
> Ich I use Java6 I get an access violation and the end of the app, I think when it happens when java is unloding the dll. I tested it with a plain dll without gc and any other D function:
>
> --DLL
>
> import std.c.windows.windows;
> HINSTANCE g_hInst;
>
> extern(C) export int getX() {
> return 1;
> }
>
>
> extern (Windows)
> BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) {
> switch (ulReason) {
> case DLL_THREAD_ATTACH:
> case DLL_THREAD_DETACH:
> return false;
> }
> g_hInst=hInstance;
> return true;
>
> }
>
> If I use a c++ dll created with bcc32/dmc everthing runs fine with Java6.
>
> thank you for helping
> christoph
Hi Christoph,
Sorry I can't help you with your problem directly. However, if you plan
to use D's garbage collection, be warned that D and Java's garbage
collectors don't get along (since they use the same signals). If you
need the GC, IPC is a better solution (check
http://www.dsource.org/projects/dbus-d/ ). Frank Benoit probably knows
more about that than I do.
If you don't need D's GC, then JNI is a perfect solution, but I'm not
sure exactly what your problem is.
Sorry I couldn't be more helpful,
Robert
More information about the Digitalmars-d-learn
mailing list