delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/18/04:39:54

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Sun, 18 Mar 2001 10:39:14 +0100 (MET)
From: Torsten Iversen <torsten AT cs DOT auc DOT dk>
To: cygwin AT cygwin DOT com
Subject: Re: Dll problem with NT -nmo-cygwin
In-Reply-To: <Pine.GSO.4.21.0103172102300.6566-100000@mega.cs.auc.dk>
Message-ID: <Pine.GSO.4.21.0103181033040.12716-100000@mega.cs.auc.dk>
MIME-Version: 1.0

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 AT 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 AT 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 AT 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 AT 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 AT 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 AT 12
> 
> 
> And finally the def file contains:
> 
> 
> LIBRARY FILE
> DESCRIPTION "Dll built with Cygwin"
> EXPORTS
> ReturnValue AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019