Hi,
I have a problem when trying to debug a shared library developed in C. Im following the steps included in the docs, in chapter 33 (extending SQL), section 33.9 (C-Language functions) http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html Ive successfully compiled the example tablefunc.c which is included in http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/tablefunc/ Im using Eclipse 3.2 and have installed mingw. The problem I have is that I cannot debug the functions. When trying to debug, I choose the option C/C++ attach to local application. Then a list of processes to select appears. The only option I can choose is pgAdmin3.exe. When I choose it and open a SQL script in the pgadmin and execute the function Im trying to debug, the function works properly but in doesnt enter the debug. This is the code I use to create the function. Its linked to the dll compiled with Eclipse. CREATE OR REPLACE FUNCTION mi_crosstab(text) RETURNS SETOF record AS E'D:\\\\eclipse\\\\workspace\\\\tablefunc_lib\\\\Debug\\\\tablefunc_lib', 'mi_crosstab' LANGUAGE 'c' VOLATILE STRICT; ALTER FUNCTION mi_crosstab(text) OWNER TO postgres; I have seen that there are several processes called postgres.exe in the system administrator window. I have managed to make them appear in the list I mentioned, but when I select them in the debug option, I get the following error message: Attach to process failed. Im also trying to debug using Microsoft Visual C++ 6.0. With this option I cannot even compile any library. This is the simple code Im trying to compile: extern "C"{ #include <postgres.h> #include <string.h> #include <fmgr.h> }; PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(add_one_float8); __stdcall DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } extern "C" { __declspec(dllexport) Datum add_one_float8(PG_FUNCTION_ARGS) { /* The macros for FLOAT8 hide its pass-by-reference nature. */ float8 arg = PG_GETARG_FLOAT8(0); PG_RETURN_FLOAT8(arg + 1.0); } }; When doing so I get 3 warnings referred to the MAGIC FUNCTION declaration, and the function doesnt work. warning C4273: 'Pg_magic_func' : inconsistent dll linkage. dllexport assumed. warning C4273: 'pg_finfo_add_one_float8' : inconsistent dll linkage. dllexport assumed. Linking... LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification Creating library Debug/Postgres_dll.lib and object Debug/Postgres_dll.exp Postgres_dll.dll - 0 error(s), 3 warning(s) The Pg_magic_func is declared in the header file fmgr.h, I have checked it but I dont see any error there. Please, if you could provide me some feedback, Id be really grateful!! Thanks, Aurora