Hi, I want to make a function in C for postgresql, this is the code:
#define _USE_32BIT_TIME_T #define BUILDING_DLL 1 #include "postgres.h" #include "fmgr.h" #include "executor\spi.h" /* SPI - Server Programming Interface */ #if defined(_MSC_VER) || defined(__MINGW32__) #define PG_GETINF_EXPORT __declspec (dllexport) #else #define PG_GETINF_EXPORT #endif PG_MODULE_MAGIC; PG_GETINF_EXPORT PG_FUNCTION_INFO_V1(suma); Datum suma(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); PG_RETURN_INT32(arg + 1); }; This compile sucessfull, but when I try to use: CREATE OR REPLACE FUNCTION add_one(integer) RETURNS integer AS 'C:\Documents and Settings\Administrador\Escritorio\test\test.dll', 'pg_finfo_suma' LANGUAGE 'c' VOLATILE STRICT COST 1; I get it: ERROR: biblioteca «C:\Documents and Settings\Administrador\Escritorio\test\test.dll» incompatible: no se encuentra el bloque mágico HINT: Se requiere que las bibliotecas de extensión usen la macro PG_MODULE_MAGIC. Please help me! I don't know to do. Thanks