This is the mail archive of the cygwin@sourceware.cygnus.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]

Problem with relocatable DLL in b18


Hi,
I'm new in GnuWin32 programming and I want to make a
relocatable DLL according to the example residing at www.cygnus.com.
I compiled it under Beta17 and it worked fine, but if I compile it
under Beta18, it doesn't work.
The 'start main.exe' command sais: "The program is in an invalid format,
and cannot be run. It may be damaged."
And I got an "Error Starting Program" dialog box with a message:
"Unable to run f:\tmp\main.exe" and an "OK" button.

What is wrong? Me or Beta18?

Please help me!
Thanks in advance,
					Keresztg

P.s.: Here is the shell script:

#! /bin/sh
#  Example Script to compile and link a relocatable DLL
#    Files that make up the DLL = foo.c foo2.c init.cc fixup.c.
#        (init.cc and fixup.c are housekeeping routines needed for the DLL. The actual
#                      library routines are in foo.c and foo2.c)
# ***Fill in your path to libcygwin.a here (with no trailing slash)***
LIBPATH=/f/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib

# Compile source files:
gcc -c foo.c
gcc -c foo2.c
gcc -c init.cc
gcc -c fixup.c

# Make .def file:
echo EXPORTS > fooB.def
nm foo.o foo2.o init.o fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> fooB.def

# Link DLL.
ld --base-file fooB.base --dll -o fooB.dll foo.o foo2.o init.o fixup.o \ $LIBPATH/libcygwin.a -e _dll_entry@12 
dlltool --as=as --dllname fooB.dll --def fooB.def --base-file fooB.base --output-exp fooB.exp
ld --base-file fooB.base fooB.exp --dll -o fooB.dll foo.o foo2.o init.o fixup.o \ $LIBPATH/libcygwin.a -e _dll_entry@12 
dlltool --as=as --dllname fooB.dll --def fooB.def --base-file fooB.base --output-exp fooB.exp
ld fooB.exp --dll -o fooB.dll foo.o foo2.o init.o fixup.o \ $LIBPATH/libcygwin.a -e _dll_entry@12 

# Build the fooB.a lib to link to:
dlltool --as=as --dllname fooB.dll --def fooB.def --output-lib fooB.a

# Linking with main
gcc main.c fooB.a -o main.exe

+-----------------------------------------------------------------------------+
| Keresztfalvi Gabor			         Budapesti Piarista Gimnazium |
| Web Page: http://www.piar.hu/~keresztg/				      |
| E-Mail: keresztg@podolin.piar.hu				:-)	      |
+---------- This message was transmitted on 100% recycled electrons ----------+

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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