Hi Michael. The latest release candidate of Mingw binutils fixed some problems with autoimporting variables from DLL's. More details at:
http://sourceforge.net/project/shownotes.php?release_id=127364 I believe that there have also been similar changes in one or two other recent MinGW32 binutils releases. Cheers Mike Thomas. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of michael vorin Sent: Thursday, December 12, 2002 8:14 AM To: [EMAIL PROTECTED] Subject: GHC Undefined Whilst I was trying to get the curses binding example in QForeign to compile - I stumbled on what I believe to be a bug. Essentialy I believe that the version of ld.exe that you have packaged up with ghc 5.04 win32 has a bug or is perhaps badly configured. ghc uses - GNU ld version 2.11.90 (20010704) (with BFD 2.11.90) which did not properly resolve external references to variables (see below). I resolved problem by using - GNU ld version 2.13, from current mingw release. my configuration GHC 5.04 Win32 running on win2K platform. What I encountered -------------------- ghc -fglasgow-exts CursesTest.hs CursesTest_hsc.c Curses.hs curses_hsc.c -lpdcurses curses_hsc.o(.text+0x4):curses_hsc.c: undefined reference to `stdscr' curses_hsc.o(.text+0x10):curses_hsc.c: undefined reference to `LINES' curses_hsc.o(.text+0x1c):curses_hsc.c: undefined reference to `COLS' curses_hsc.o(.text+0x28):curses_hsc.c: undefined reference to `COLOR_PAIRS' curses_hsc.o(.text+0x34):curses_hsc.c: undefined reference to `COLORS' when I had a look at the object files and the libpdcurses.dll, the appropriate symbols were in fact defined, and in fact all functions were resolved, the above symbols represent bindings to variables declared as follows:- extern int LINES; 2. setup of a test ----------------- I setup a test (test.c attached) where I just had one external reference that I was trying to resolve. I compiled it curses\tst-lines>ghc tst.c -o tst.exe -lpdcurses tst.o(.text+0x4):tst.c: undefined reference to `LINES' curses\tst-lines>gcc tst.c -o tst.exe -lpdcurses Info: resolving _LINES by linking to __imp__LINES (auto-import) the above should give the same result, i.e. the later result 3. fix -------- I copied ld.exe from my mingw release (version 2.13) over ld.exe in the ghc release (version 2.11.90 ). This solved my problem 4. postmortem ------------- why the problem ? Does this problem occur with all external variable references or is limitted to a few dll libraries, does it occur linking against static libraries ? I don't know _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail _______________________________________________ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
