This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: DLL generation under Cygwin
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Ted Yu <ted_yu at yahoo dot com>
- Cc: cygwin at cygwin dot com
- Date: Wed, 5 May 2004 12:07:37 -0400 (EDT)
- Subject: RE: DLL generation under Cygwin
- References: <20040505154908.91567.qmail@web12108.mail.yahoo.com>
- Reply-to: cygwin at cygwin dot com
On Wed, 5 May 2004, Ted Yu wrote:
> Hi,
> I deleted .o files and compiled with -mno-cygwin.
> cygwin1.dll is still needed because it contains
> malloc() and free() which are used in my DLL.
So does MSVCRT.dll, which is what MinGW uses for its runtime.
> Here is my Makefile:
> OBJS = \
> 8d0.o 8d1.o 8d2.o \
> 8c0.o 8c1.o 8c2.o \
> 8r0.o 8r1.o 8r2.o \
> 8u0.o 8u1.o 8u2.o \
> 8v0.o 8v1.o 8v2.o \
> 4d0.o 4d1.o 4d2.o \
> 4c0.o 4c1.o 4c2.o \
> 4r0.o 4r1.o 4r2.o \
> 4u0.o 4u1.o 4u2.o \
> 4v0.o 4v1.o 4v2.o \
> 8sc.o 8sr.o 8mc.o 8mr.o \
> 4sc.o 4sr.o 4mc.o 4mr.o \
> fftfreq.o djbfft2d.o /lib/libc.a
^^^^^^^^^^^
Why are you linking in libc.a explicitly? The appropriate version should
be automatically linked in by the compiler.
> CFLAGS = -O1 -fomit-frame-pointer -malign-double -mno-cygwin
> djbfft.dll: $(OBJS)
> $(LD) -s --base-file fft.base --dll -o $(DLLNAME) $(OBJS) $(LIBS) -e 'fftEntry@12'
^^^^^^^^^^ ^^^^^^^
What's LIBS set to? What's DLLNAME set to?
> dlltool --as=$(AS) --dllname $(DLLNAME) --def fft.def --base-file fft.base --output-exp fft.exp
^^^^^
What's AS set to?
> $(LD) -s --base-file fft.base fft.exp -dll -o $(DLLNAME) $(OBJS) $(LIBS) -e 'fftEntry@12'
> dlltool --as=$(AS) --dllname $(DLLNAME) --def fft.def --base-file fft.base --output-exp fft.exp
> $(LD) fft.exp --dll -o $(DLLNAME) $(OBJS) $(LIBS) -e 'fftEntry@12'
> dlltool --def fft.def --dllname $(DLLNAME) --output-lib fft.lib
It also looks like you're using the Cygwin version of "ld", and dlltool
will probably invoke the Cygwin versions of tools, too. Try adding
-mno-cygwin to CC rather than CFLAGS, i.e.,
CC = gcc -mno-cygwin
CFLAGS = -O1 -fomit-frame-pointer -malign-double
...
and using $(CC) to link instead of $(LD) (you can pass flags to ld via
the -Wl,... options, IIRC).
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/