[Monetdb-developers] Linking against a library

Wouter Scherphof wouter.scherphof at gmail.com
Mon Oct 9 16:32:54 CEST 2006


Hi,

My first module (called "geom"), created from "template", compiles (on
Windows XP with the "native tools") and the hello() function works.

Now I want to use some functions of a certain library (the
GEOS<http://geos.refractions.net>C API). I'm fairly new to C, so
probably I'm doing something obvious wrong.

What I have is a header file
"geos_c.h<http://geos.refractions.net/ro/doxygen_docs/html/geos__c_8h-source.html>"
and a DLL "geos_c_fw.dll" (I chose to use a prebuilt DLL for now, since I
didn't manage to build the GEOS library as well :-(.)
I put those in the NT directory.

In my geom.mx, I added:
*#include* <geos_c.h>*
**int* testGeos( ){*
*  initGEOS(*NULL*,*NULL*);*
*  finishGEOS();*
**  return* GDK_SUCCEED;*
*}

Now, when I run "nmake NEED_MX=1", I get:
(...)
        cl -GF -W3 -wd4273 -wd4102 -MD -nologo -Zi -Ox -I. -I.\..
"-IC:\Pthreads\include" -I.\..\..\src "-IC:\monetdb\MonetDB\NT\include"
"-IC:\monetd
b\MonetDB\NT\include\common" "-IC:\monetdb\MonetDB\NT\include\gdk"
"-IC:\monetdb\MonetDB\NT\include\monet"
"-IC:\monetdb\MonetDB\NT\include\plain" "-I
C:\monetdb\MonetDB\NT\include\mapi" -DNDEBUG   -DLIBGEOM -DCOMPILE_DL_GEOM
-Fo"geom.obj" -c "geom.c"
geom.c
        cl -GF -W3 -wd4273 -wd4102 -MD -nologo -Zi -Ox -I. -I.\..
"-IC:\Pthreads\include" -I.\..\..\src "-IC:\monetdb\MonetDB\NT\include"
"-IC:\monetd
b\MonetDB\NT\include\common" "-IC:\monetdb\MonetDB\NT\include\gdk"
"-IC:\monetdb\MonetDB\NT\include\monet"
"-IC:\monetdb\MonetDB\NT\include\plain" "-I
C:\monetdb\MonetDB\NT\include\mapi" -DNDEBUG  -LD -Felib_geom.dll
geom.glue.obj geom.obj /link "/LIBPATH:C:\monetdb\MonetDB\NT\lib"
"/LIBPATH:C:\monet
db\MonetDB\NT\lib\MonetDB" libbat.lib libmonet.lib
   Creating library lib_geom.lib and object lib_geom.exp
geom.obj : error LNK2019: unresolved external symbol _finishGEOS referenced
in function _testGeos
geom.obj : error LNK2019: unresolved external symbol _initGEOS referenced in
function _testGeos
lib_geom.dll : fatal error LNK1120: 2 unresolved externals
So the compilation of geom.c succeeds, but the linking of lib_geom.dll
fails. Apperently, the geos_c_fw.dll is not found. I tried putting it in one
of the /LIBPATH, but that doesn't help.

How can I make this work?

Best regards,
Wouter Scherphof.

Utrecht Professional School,
The Netherlands.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20061009/f5b74cf7/attachment.html>


More information about the developers-list mailing list