[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Linking error with g++/mingw linking a C library
From: |
ms . misc . stuff |
Subject: |
Linking error with g++/mingw linking a C library |
Date: |
Mon, 5 Jan 2009 19:16:28 -0800 (PST) |
User-agent: |
G2/1.0 |
I am linking a C library (dwraplib.dll) also built with mingw to
mydll.dll - this is a CPP dll.
I am getting an undefined reference to `clibfn_register_name(char*)'
error when I try to call a funcation in the dwraplib.dll.
I have the library in the same directory I am linking my code from.
I am not being able to figure out the reason of this.
Here is the relevant makefile segment:
>>>>>>>>
mydll.dll :
g++ $(DEFINES) -c mydll.cpp
g++ -shared -o mydll.dll mydll.o -L. -ldwraplib \
-Wl,--out-implib=libmydll.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
<<<<<<<<
This is what the output looks like:
-------------------->
gcc -I. -I.. -g -Wall -c mydll.cpp
g++ -shared -o mydll.dll mydll.o -L. -ldwraplib \
-Wl,--out-implib=libmydll.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
Creating library file: libmydll.dll.a
mydll.o: In function `ZN6mydllA7mydllFnEv':
C:/DCC/cvsdcc_new/L2/testdll/mydll.cpp:18: undefined reference to
`clibfn_register_name(char*)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [mydll.dll] Error 1
mingw32-make[1]: Leaving directory `C:/testdll'
mingw32-make: *** [all] Error 2
<-----------------------------
Here is the makefile for the C library (dwraplib.dll):
C:\dwraplib>mingw32-make dwraplib.dll
mingw32-make[1]: Entering directory `C:/dwraplib'
gcc -g -Wall -I. -DMINGW -DWINDOWS -DDBCDEF -shared dwraplib.c -o
dwraplib.dll
-ldbus-1 -Ldbus -lws2_32 \
-Wl,--out-implib=libdwraplib.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
dwraplib.c: In function `dbus_set_addr':
dwraplib.c:63: warning: unused variable `err'
dwraplib.c:64: warning: unused variable `conn'
Creating library file: libdwraplib.dll.a
mingw32-make[1]: Leaving directory `C:/dwraplib'
and its makefile:
dwraplib.dll: dwraplib.c
gcc -DMINGW -DWINDOWS -g -Wall -I.
$(ADD_CFLAGS) -DDBCDEF -shared $? -o $@ -lws2_32 \
-Wl,--out-implib=libdwraplib.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import
Is there sme thing I am missing?
PS: When I try to link another C lib and access its functions, that
goes through fine?
Thanks
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Linking error with g++/mingw linking a C library,
ms . misc . stuff <=