This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Dll problem with NT -nmo-cygwin


I got it working by modifying the Makefile, which, under closer scrutiny,
seemed wrong. Sorry if this mail looks like shit, but the dll build
procedure unfortunalely requires very long command lines :-/

The -shared was missing in the last call to gcc, and I also realized that
-s really means -shared in the cygwin online help for building dlls,
since there is no -s mentioned in the gcc man page.

Torsten

New Makefile section for building the dll:

file.dll: file.o
 	gcc -shared -mno-cygwin -Wall -Werror -Wl,--base-file,file.base -o
file.dll file.o -Wl,-e,_DllEntry@12
 	dlltool --base-file file.base --def file.def --output-exp file.exp --dllname file.dll
 	gcc -shared -mno-cygwin -Wall -Werror -Wl,--base-file,file.base -o
file.dll file.o -Wl,-e_DllEntry@12
 	dlltool --base-file file.base --def file.def --output-exp file.exp --dllname file.dll
 	gcc -shared -mno-cygwin -Wall -Werror -Wl,file.exp
-o file.dll file.o -Wl,-e,_DllEntry@12


On Sat, 17 Mar 2001, Torsten Iversen wrote:

> Hi
> 
> I have a dll, which works fine under windows98, but when i run it under
> windows NT it crashes as soon as I make an assignment to a static variable
> in the dll. The dll was compiled with -mno-cygwin and the crash occurs at
> the very first assignment.
> 
> I have created a small test program which shows the problem. The dll is
> linked against a Borkand Delphi 5.0 application.
> 
> Here is the source for the test program:
> 
> #include <Windows.h>
> 
> int main()
> {
>   return 0;
> }
> 
> int x;
> 
> /* Debug routine to verify that the dll is correctly linked to the app */
> int STDCALL ReturnValue(int value)
> {
>   // x = 5; // this assignment causes a crash under winnt
>   return value;
> }
> 
> int STDCALL DllEntry(int a, int b, int c)
> {
>   return 1;
> }
> 
> 
> I build the dll  file with this makefile:
> 
> 
> file.o: file.c
> 	gcc -c -mno-cygwin -o file.o file.c
> 
> file.dll: file.o
> 	gcc -s -mno-cygwin -Wall -Werror -Wl,--base-file,file.base -o file.dll file.o -Wl,-e,_DllEntry@12
> 	dlltool --base-file file.base --def file.def --output-exp file.exp --dllname file.dll
> 	gcc -s -mno-cygwin -Wall -Werror -Wl,--base-file,file.base -o file.dll file.o -Wl,-e_DllEntry@12
> 	dlltool --base-file file.base --def file.def --output-exp file.exp --dllname file.dll
> 	gcc -mno-cygwin -Wall -Werror -Wl,file.exp -o file.dll file.o  -Wl,-e,_DllEntry@12
> 
> 
> And finally the def file contains:
> 
> 
> LIBRARY FILE
> DESCRIPTION "Dll built with Cygwin"
> EXPORTS
> ReturnValue@4
> 
> 
> 
> Can anyone tell me what is wrong?
> 
> Torsten
> 
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]