[Monetdb-developers] Linking against a library

Niels Nes Niels.Nes at cwi.nl
Mon Oct 9 19:02:04 CEST 2006


On Mon, Oct 09, 2006 at 04:32:54PM +0200, Wouter Scherphof wrote:
> 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>"

On windows you need a file geos_c_fw.lib during the linking phase.
The dlls are used during runtime.

Niels
> 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.

> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers


-- 

Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02,  phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels   e-mail: Niels.Nes at cwi.nl




More information about the developers-list mailing list