DLL jni Java6 update 1
Christoph
christoph at singewald.at
Thu Mar 13 08:23:30 PDT 2008
Robert Fraser Wrote:
> 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
Hi Robert!
Thank you for your fast reply. You're are right, thats a real problem under unix/linux. But the curent problem appear to me under windows, I did not test it under linux at the moment. So may be I have to find another solution, because I want to use it under inw32 and linux
Christoph
More information about the Digitalmars-d-learn
mailing list