pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedMissing block Magic
3+ messages / 2 participants
[nested] [flat]
* Missing block Magic
@ 2012-06-05 16:12 Alejandro Carrillo <fasterzip@yahoo.es>
0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Carrillo @ 2012-06-05 16:12 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Missing block Magic
@ 2012-06-05 17:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alejandro Carrillo <fasterzip@yahoo.es>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2012-06-05 17:00 UTC (permalink / raw)
To: Alejandro Carrillo <fasterzip@yahoo.es>; +Cc: pgsql-performance
Alejandro Carrillo <fasterzip@yahoo.es> writes:
> 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.
[ scratches head ... ] Your source code looks fine. Are you sure you
are pointing to the right copy of the .dll file?
If you added the PG_MODULE_MAGIC; line after getting this error, it's
likely that the old version of the .dll is already loaded into the
server's memory, in which case what you need to do to get rid of it
is to restart the server, or at least start a fresh session.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Missing block Magic
@ 2012-06-05 18:51 Alejandro Carrillo <fasterzip@yahoo.es>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Carrillo @ 2012-06-05 18:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-performance
I restart and doesn't work. :(
Please help me!
>________________________________
> De: Tom Lane <tgl@sss.pgh.pa.us>
>Para: Alejandro Carrillo <fasterzip@yahoo.es>
>CC: "pgsql-performance@postgresql.org" <pgsql-performance@postgresql.org>
>Enviado: Martes 5 de junio de 2012 12:00
>Asunto: Re: [PERFORM] Missing block Magic
>
>Alejandro Carrillo <fasterzip@yahoo.es> writes:
>> 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.
>
>[ scratches head ... ] Your source code looks fine. Are you sure you
>are pointing to the right copy of the .dll file?
>
>If you added the PG_MODULE_MAGIC; line after getting this error, it's
>likely that the old version of the .dll is already loaded into the
>server's memory, in which case what you need to do to get rid of it
>is to restart the server, or at least start a fresh session.
>
> regards, tom lane
>
>--
>Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-performance
>
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2012-06-05 18:51 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 16:12 Missing block Magic Alejandro Carrillo <fasterzip@yahoo.es>
2012-06-05 17:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-06-05 18:51 ` Alejandro Carrillo <fasterzip@yahoo.es>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox