[Monetdb-developers] Linking against a library
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 GEOShttp://geos.refractions.netC API). I'm fairly new to C, so probably I'm doing something obvious wrong.
What I have is a header file "geos_c.hhttp://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.
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 GEOShttp://geos.refractions.netC API). I'm fairly new to C, so probably I'm doing something obvious wrong.
What I have is a header file "geos_c.hhttp://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=D... _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
participants (2)
-
Niels Nes
-
Wouter Scherphof