Hello. I'm trying to create a C-procedure returning text variable - again :). Postgres 8.3.3 (standard binaries - so built by means of MSVC), WinXP SP2. I also use MSVC 2005 for compilation my library. Configuration type - Dynamic Library (.dll) Additional include directories - D:\pgsql83\include;D:\pgsql83\include\server;D:\pgsql83\include\server\port\win32 Additional library directories - D:\pgsql83\lib Additional dependencies - postgres.lib Compile as C Code (/TC) (By the way, I can't compile it as C++ Code (/TP) In this case I get a lot of errors. F.e. >d:\pgsql83\include\server\nodes\primnodes.h(1078) : error C2238: unexpected token(s) preceding ';' 1>d:\pgsql83\include\server\nodes\parsenodes.h(167) : error C2059: syntax error : 'typeid' ) So, here is the code: -------------------------------------------------- include "postgres.h" #include "fmgr.h" #include "executor/executor.h" #include "utils/timestamp.h" #include "utils/builtins.h" #include "utils/formatting.h" #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif #define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstrp))) PG_FUNCTION_INFO_V1(getTimeFromApplication); Datum getTimeFromApplication(PG_FUNCTION_ARGS) { PG_RETURN_TEXT_P(GET_TEXT("success")); } I can compile it and get the library, but there are some warnings: 1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' : inconsistent dll linkage 1> d:\pgsql83\getstring\c_getstring.c(10) : see previous definition of 'Pg_magic_func' 1>d:\pgsql83\getstring\c_getstring.c(24) : warning C4273: 'pg_finfo_getTimeFromApplication' : inconsistent dll linkage 1> d:\pgsql83\getstring\c_getstring.c(24) : see previous definition of 'pg_finfo_getTimeFromApplication' 1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4311: 'type cast' : pointer truncation from 'char [8]' to 'Datum' 1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4312: 'type cast' : conversion from 'Datum' to 'Pointer' of greater size 1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4311: 'type cast' : pointer truncation from 'varlena *' to 'Datum' ------------------------------------------------------- Then I put the library into 'lib' directory and create the stored procedure: CREATE OR REPLACE FUNCTION "service"."get_app_time" () RETURNS text AS '$libdir/getstring', 'pg_finfo_getTimeFromApplication' LANGUAGE C STRICT; Then I try to run it: select * from "service"."get_app_time" (); And get an error: ERROR: invalid memory alloc request size 4294967293 What did I wrong? Thanks in advance, Marina.