Subject: Problem with relocatable DLL in b18
From: [email-masked] (Keresztfalvi Gábor 97b)

31 Aug 1997 01:31:23 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: [email-masked]
Original-Sender: [email-masked]

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: [email-masked]				:-)	      |
+---------- This message was transmitted on 100% recycled electrons ----------+

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".