Hi, I want to add a
user defined function using “Version-1 Calling Conventions” but
getting a link error. I am using MS
Visual C++ .NET (V 7.1.3) on Win XP SP 2. PostgreSQL 8.1.3. Am I missing
some lib or some other file? I saw earlier
thread “building and linking C user defined functions” and set the complier
setting to /FORCE. It create the dll but the following SQL crash psql Select
filesize('my file'); Here is the simplified
version of my problem. ERROR: ------ Rebuild All started:
Project: copytext, Configuration: Debug Win32 ------ Deleting intermediate files
and output files for project 'copytext', configuration 'Debug|Win32'. Compiling... copytext.c Linking... Creating library
Debug/copytext.lib and object Debug/copytext.exp copytext.obj : error LNK2019:
unresolved external symbol _MemoryContextAlloc referenced in function _copytext copytext.obj : error LNK2001:
unresolved external symbol __imp__CurrentMemoryContext copytext.obj : error LNK2019:
unresolved external symbol _pg_detoast_datum referenced in function _copytext Debug/copytext.dll : fatal
error LNK1120: 3 unresolved externals Build log was saved at
"file://..\copytext\Debug\BuildLog.htm" copytext - 4 error(s), 0
warning(s) File copytext.c: #include "postgres.h" #include <string.h> #include "fmgr.h" PG_FUNCTION_INFO_V1(copytext); Datum copytext(PG_FUNCTION_ARGS) { text *t =
PG_GETARG_TEXT_P(0); /* ……… PG_RETURN_TEXT_P(new_t); } I can do this on
Linux but looks like windows have some issues. Thanks. |