delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/08/31/01:31:23

From: keresztg AT podolin DOT piar DOT hu (=?ISO-8859-2?Q?Keresztfalvi_G=E1bor_97b?=)
Subject: Problem with relocatable DLL in b18
31 Aug 1997 01:31:23 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.A41.3.96.970827195219.28510A-100000.cygnus.gnu-win32@podolin.piar.hu>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT 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 AT 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 AT 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 AT podolin DOT piar DOT hu				:-)	      |
+---------- This message was transmitted on 100% recycled electrons ----------+

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

- Raw text -


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