DLL initialization problem

Klemen Zagar klemen.zagar@ijs.si
Wed Jun 21 01:37:00 GMT 2000


I am trying to build a DLL with cygwin gcc that would work with 
non-cygwin executables (e.g., those built with Inprise Delphi). I 
presume that I have to somehow initialize the cygwin DLL before using 
memory allocation and I/O functions from my DLL, but I do not know how 
to do that. Here's what I've tried so far:

 - With May 2000 version of cygwin1.dll, I've put a call to 
cygwin_crt0(main function = NULL) in the DLL's entry point. Everything 
blocked when the DLL was loaded.

 - With May 2000 version of cygwin1.dll, I've put a call to 
cygwin_attach_dll(handle, main = NULL) in DLL's entry point. Malloc 
crashed anyway as if I hadn't done that.

 - With June 2000 version of cygwin1.dll I've put a call to 
cygwin_dll_init() in DLL's entry point. Everything blocked when the 
DLL was loaded.

Here is how the last DLL entry point looks like:

__attribute__((stdcall))
int dll_entry(int handle, int reason, void *ptr)
{ 
 if(reason == DLL_PROCESS_ATTACH)
    {
      cygwin_dll_init(); // ...doesn't return...
    }
  return 1;
}

So... what is the right way to initialize the cygwin DLL (before I try 
out all its functions) :-)

Regards and thank you in advance,
  Klemen.




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list