From: | <A(dot)Bhattacharya(at)sungard(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Cc: | <Ashish(dot)Arya(at)sungard(dot)com> |
Subject: | Incompatible library : Missing Magic Block |
Date: | 2009-10-22 11:41:32 |
Message-ID: | 4AD2336877609F41A2B0D53BAD09FC579D7290@VOO-EXCHANGE07.internal.sungard.corp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I am trying to write a C function (using Postgres external methods) in
windows XP and am using Postgres 8.3.7 version and creating a dll using
Microsoft Visual Studio 2005.
However I have included all the required headers and PG_MODULE_MAGIC in
my code. (Please find below the example code which I am compiling using
MSVC)
_________________________________________________________________
// add.cpp : Defines the entry point for the DLL application.
//
#define _USE_32BIT_TIME_T
#include "postgres.h"
#include "fmgr.h"
//#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
//#endif
PG_FUNCTION_INFO_V1(add_one);
Datum add_one(PG_FUNCTION_ARGS)
{
int32 arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg + 1);
}
_____________________________________________________________________
I could compile the code successfully and generate the dll with no
errors but whenever I am compiling the below postgres function using
that dll, Postgres throws an error
ERROR: incompatible library "C:/Program
Files/PostgreSQL/8.3/lib/add.dll": missing magic block
HINT: Extension libraries are required to use the PG_MODULE_MAGIC
macro.
Postgres Function
CREATE OR REPLACE FUNCTION add_one(IN int) RETURNS int AS '$libdir/add',
'add_one' LANGUAGE C;
I am using the Postgres 8.3.7 headers to compile the program and have
followed the steps to compile the program in MSVC.
Kindly provide your help at the earliest as this is really a show
stopper for us.
Many thanks in advance
Ambarish Bhattacharya
From | Date | Subject | |
---|---|---|---|
Next Message | Massa, Harald Armin | 2009-10-22 11:46:43 | Re: Incompatible library : Missing Magic Block |
Previous Message | Peter Eisentraut | 2009-10-22 11:12:22 | Re: Design question about partitioning order information across tables |