Subject: Re: JNI functions under g++
From: [email-masked] (Mumit Khan)

27 Oct 1998 14:31:56 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: JAMES DOYLE <[email-masked]>
Cc: Gnu Win32 Mailing List <[email-masked]>

On Fri, 23 Oct 1998, JAMES DOYLE wrote:

> 	But, as Kiyoko Aoki and Andrew Mickish have noted
> (re: B19 dll with JNI causing Dr. Watson, October 19), doing
> C++ memory allocations doesn't work under GnuWin32 either.  
> My DLL fails the first time it tries to call new().  I just thought
> I'd let Kiyoko and Andrew (and other JNI people out there) know
> there's another data point indicating trouble with JNI and
> memory allocation.  Also, I thought you'd be interested to know
> that MSVC++ has trouble with JNI and memory allocation, too.
> I've posted to comp.lang.java.programmer asking if JNI
> programmers in general have been able to work with C++ allocation
> on Windows.  

Turns out that the problem with cygwin dll when loaded from MSVC 
app is a different one -- cygwin DLL is not just not initialized 
properly and pretty much everything is liable to crash. Of course,
there may be more issues with C++, but we need to track this basic
problem down first.

Hopefully we'll track it down soon and fix. I do recommend not holding
your breath however ;-)

Good news is that mingw works like a charm.

I just released a new version of dllhelpers that should allow to build
JNI dlls using a single command (cf: dllwrap). I'll announce an example
JNI (I'm borrowing one from Andrew Mickish), complete with Makefile, 
sometime in the next few days.

Now, it's as simple as:
  
  $ gcc -c -I<jdk_root>/include [ ... ] HelloWorldImp.c
  $ dllwrap -o HelloWorld.dll --add-stdcall-suffix HelloWorldImp.o
  $ java [...]

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".