From: | Alejandro Carrillo <fasterzip(at)yahoo(dot)es> |
---|---|
To: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Missing block Magic |
Date: | 2012-06-05 16:12:34 |
Message-ID: | 1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-06-05 17:00:07 | Re: Missing block Magic |
Previous Message | Shaun Thomas | 2012-06-05 14:57:14 | Re: Sequencial scan in a JOIN |