Mail Archives: cygwin/1997/07/17/17:31:38
Hi,
I want to use some functions of a dll library in my code
that gets compiled with gcc. To test if that works I created
a small dll example that works fine under msvc.
Then I created a def file and used
dlltool --def foo.def --dllname foo.dll --output-lib foo.a
That worked fine.
But when I link it with together with footest.c, which calls the
dll-function, I get this result :
bash$ gcc footest.c foo.a -o footest.exe
C:\TEMP\cc0014041.o(.text+0x2e):footest.c: undefined reference to `myhello'
gcc: Internal compiler error: program ld got fatal signal 1
Below are the sources I use :
-----------------------------------------------------------------
foo.c : source file for dll, compiled with msvc4.2
#include "stdio.h"
__declspec(dllexport) void myhello()
{
printf("hello world\n");
}
-----------------------------------------------------------------
footest.c : source for gcc
#include "stdio.h"
extern void myopinion();
int main()
{
printf("start my dll function\n");
myopinion();
return(0);
}
-----------------------------------------------------------------
foo.def :
LIBRARY foo
EXPORTS
myhello AT 0
------------------------------------------------------------------
output of nm :
bash$ nm foo.a | grep T
00000000 T _myhello AT 0
I then downloaded the directX package from
http://dragon.acadiau.ca/~025668b/develop/cygnus
but again, when I tried to compile it with
gcc main.c libddraw.a -o main.exe
I get this :
C:\TEMP\cc0014301.o(.text+0x72):main.c: undefined reference to
`CreateWindowExA AT 48'
C:\TEMP\cc0014301.o(.text+0x88):main.c: undefined reference to `ShowWindow AT 8'
C:\TEMP\cc0014301.o(.text+0x93):main.c: undefined reference to
`UpdateWindow AT 4'
C:\TEMP\cc0014301.o(.text+0xa7):main.c: undefined reference to
`GetMessageA AT 16'
C:\TEMP\cc0014301.o(.text+0xb9):main.c: undefined reference to
`TranslateMessage AT 4'
C:\TEMP\cc0014301.o(.text+0xc2):main.c: undefined reference to
`DispatchMessageA AT 4'
C:\TEMP\cc0014301.o(.text+0x22c):main.c: undefined reference to
`GetStockObject AT 4'
C:\TEMP\cc0014301.o(.text+0x241):main.c: undefined reference to
`RegisterClassA AT 4'
C:\TEMP\cc0014301.o(.text+0x289):main.c: undefined reference to `BeginPaint AT 8'
C:\TEMP\cc0014301.o(.text+0x29b):main.c: undefined reference to `EndPaint AT 8'
C:\TEMP\cc0014301.o(.text+0x2a5):main.c: undefined reference to
`PostQuitMessage AT 4'
C:\TEMP\cc0014301.o(.text+0x2bd):main.c: undefined reference to
`DefWindowProcA AT 16'
gcc: Internal compiler error: program ld got fatal signal 1
output of nm :
bash$ nm libddraw.a | grep T
00000000 ? ___imp_thk3216_ThunkData32
00000000 T _thk3216_ThunkData32
00000000 ? ___imp_thk1632_ThunkData32
00000000 T _thk1632_ThunkData32
00000000 T _VidMemLargestFree
00000000 T _VidMemInit
00000000 T _VidMemFree
00000000 T _VidMemFini
00000000 T _VidMemAmountFree
00000000 T _VidMemAlloc
00000000 T _InternalUnlock
00000000 T _InternalLock
00000000 T _DllGetClassObject
00000000 T _DllCanUnloadNow
00000000 T _DirectDrawEnumerateW
00000000 T _DirectDrawEnumerateA
00000000 T _DirectDrawCreateClipper
00000000 T _DirectDrawCreate
00000000 T _DSoundHelp
00000000 T _DDInternalUnlock
00000000 T _DDInternalLock
00000000 T _DDHAL32_VidMemFree
00000000 T _DDHAL32_VidMemAlloc
Does anybody know why the linker cannot find the symbols?
thanks in advance,
Bijan
/\
. /\ / \
------------------------------------------------ / \/ \/ \
Bijan Tuysserkani / / \
Qualcomm Inc. \
5450 Western Ave.
Boulder, CO 80301 (303) 473-6852 (voice)
btuysser AT qualcomm DOT com (303) 473-6665 (fax)
-
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 -