Subject: Re: B19 dll with JNI causing Dr. Watson to drop by...
From: [email-masked] (Andrew Mickish)

20 Oct 1998 20:27:25 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: root <[email-masked]>, [email-masked]

root wrote:

> >
> > I am using g++ version egcs-2.91.57 (1.1 release) on NT4 (SP3) to create a
> > dll that is called from my Java program through JNI.  My problem is that
> > my Java app can call the C++ routine ok, but Dr. Watson pops up in the
> > following cases:
> >
> > 1. Initializing anything with new or malloc
> > 2. Calling another c++ routine that allocates any memory as in above
> >
> You should initialize your run time when your library is loaded, and clean-up
> when it is unloaded.
> In your LibMain procedure, you should treat the case
>         DLL_PROCESS_ATTACH:
> and call the specific run time initialization there.
> In the same way, you should handle:
>         DLL_PROCESS_DETTACH:
> and call the runtime cleanup routines.
>
> This is just basic win32 programming. Read any documentation about dlls and
> you will find this.

Why are there so many more intitialization steps and convoluted makefile
dependencies (e.g., init.cc) for generating DLLs from gcc than from Visual C++?
I have generated many successfull DLLs from VC++ just by exporting functions and
not worrying about initialization and entry points.  Can't gcc be enhanced
somehow to produce DLLs as effortlessly?

--Andrew Mickish
  http://www.andrew.cmu.edu/~am2q/

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