Subject: More DLL Woes
From: [email-masked] (David Coe)

4 Jun 1997 23:54:35 -0700
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
X-Mailer: Mozilla 3.01Gold (WinNT; I)
MIME-Version: 1.0
Original-To: Cygnus Gnu-win32 <[email-masked]>
Content-Type: multipart/mixed; boundary="------------27F6173B462"
Original-Sender: [email-masked]

This is a multi-part message in MIME format.

--------------27F6173B462
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

G'day folks!

Running on NT4, B18 with Sergey's patched cygnus.dll / libcygwin.a and
Mumit Khan's ported G77, it's proved very simple to get the PGPLOT
libraries running on X11. Getting the equivalent DLL's working has been
much more problematic even though the simple and relocatable examples on
the Cygnus website come up fine for me.

Using the attached script gives references (in the 2nd and 3rd ld) to a
missing WinMain@16. Strange - these aren't Windows routines. Changing
the LIBS variable to ... -lc -lcygwin ... fills the missing reference.
Equally strange, I thought libcygwin already contained the libc bits. 

Despite the fact that the 2nd ld generates an exception (also attached),
all this does produce an apparently working pgplot.dll even if I
wouldn't trust it all that far! My question is, am I a victim of:

- my own ignorance about building gnu-win32 dlls? 
- incorrectly mixing F77 and C code in dlls?
- residual bugs in cygwin or its toolchain?

Any helpful answers gratefully received!

-- 
Dr David Coe			     \=\
58 Fairlawn Drive, East Grinstead     \=\   Tel +44 1342 326860
West Sussex, RH19 1NT, United Kingdom  \=\  Fax +44 1342 316019

--------------27F6173B462
Content-Type: text/plain; charset=us-ascii; name="mkDLL"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="mkDLL"

#! /bin/sh

CLIB=/usr/H-i386-cygwin32/i386-cygwin32/lib
FLIB=/usr/H-i386-cygwin32/lib
XLIB=/usr/X11R6.3/lib

OBJS="../lib$1.a $CLIB/init.o $CLIB/fixup.o"
LIBS="-L$FLIB -lf2c -L$XLIB -lX11 -L$CLIB -lc -lcygwin -lkernel32"

echo EXPORTS > $1.def
nm $OBJS | grep '^........ [T] _' | sed 's/[^_]*_//' >> $1.def

ld --base-file $1.base --dll -o $1.dll $OBJS $LIBS -e _dll_entry@12
dlltool --as=as --dllname $1.dll --def $1.def --base-file $1.base --output-exp $1.exp

ld --base-file $1.base $1.exp --dll -o $1.dll $OBJS $LIBS -e _dll_entry@12
dlltool --as=as --dllname $1.dll --def $1.def --base-file $1.base --output-exp $1.exp

ld $1.exp --dll -o $1.dll $OBJS $LIBS -e _dll_entry@12
dlltool --as=as --dllname $1.dll --def $1.def --output-lib $1.a

rm $1.exp $1.def $1.base

--------------27F6173B462
Content-Type: text/plain; charset=us-ascii; name="error.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="error.txt"

(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) In cygwin_except_handler
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) Exception trapped!
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) exception C0000005 at 42D792
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) exception: ax 0 bx 2EBA868 cx 2EBB49C dx 28
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) exception: si 5E000 di FFFFFE00 bp 244EB9C sp 244EB8C
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) exception is: STATUS_ACCESS_VIOLATION
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) Stack trace:
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 0: sp = 0x244E9C0, pc = 0x1000CEAA
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 1: sp = 0x244E9DC, pc = 0x77F94512
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 2: sp = 0x244EA00, pc = 0x77F88EEB
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 3: sp = 0x244EA8C, pc = 0x77F76266
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 4: sp = 0x244EB9C, pc = 0x42D895
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 5: sp = 0x244EBF0, pc = 0x43094E
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 6: sp = 0x244F008, pc = 0x41FA39
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 7: sp = 0x244F060, pc = 0x416DCF
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 8: sp = 0x244F090, pc = 0x1000C0EA
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 9: sp = 0x244FF94, pc = 0x1000C0FB
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 10: sp = 0x244FFA0, pc = 0x4408A9
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 11: sp = 0x244FFB0, pc = 0x40103B
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 12: sp = 0x244FFC0, pc = 0x77F1B304
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) frame 13: sp = 0x244FFF0, pc = 0x0
(c:\usr\H-i386-cygwin32\bin\ld.exe 2969) End of stack trace

--------------27F6173B462--

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