C-Functions using SPI - Missing Magic Block - Mailing list pgsql-general

From Saitenheini@web.de
Subject C-Functions using SPI - Missing Magic Block
Date
Msg-id 1452910903.1355851.1278077203570.JavaMail.fmail@mwmweb049
Whole thread Raw
Responses Re: C-Functions using SPI - Missing Magic Block
Re: C-Functions using SPI - Missing Magic Block
List pgsql-general
<body bgcolor=3D"#ffffff" background=3D"https://img.web.de/v/p.gif" class=
=3D"bgRepeatYes" style=3D"background-repeat: repeat; ; background-color: rg=
b(255, 255, 255); color: rgb(0, 0, 0); font-family: verdana,geneva; font-si=
ze: 9pt; padding-left: 0px;"><div style=3D"min-height: 200px; background-im=
age: url(https://img.web.de/v/p.gif); background-repeat: repeat; background=
-color: #ffffff; font-family: verdana,geneva; font-size: 9pt; padding-left:=
 0px;">Hello,I've got a problem with Functions in C using SPI.<=
br />Using: PostgreSQL 8.3, Codeblocks, Windows Server 2003 R2<=
br />I compiled the file "pgExampleSPI.c" with the following code without a=
ny error:/* Use 32-bit timer (provided header file uses 64-bit =
timer, not* compatible with Windows postgreSQL versions */#defi=
ne _USE_32BIT_TIME_T#include "postgres.h"#include "execut=
or\spi.h"#ifdef PG_MODULE_MAGICPG_MODULE_MAGIC;#end=
ifextern Datum count_person (PG_FUNCTION_ARGS);PG_F=
UNCTION_INFO_V1(count_person);__declspec(dllexport) Datum count=
_person(PG_FUNCTION_ARGS) {    int32    =
;ret;    SPI_connect();    ret =
=3D SPI_exec("SELECT count(*) FROM person", 0);    SPI=
_finish();    PG_RETURN_INT32(ret);}=
- then I've copied the resulting file "pgExampleSPI.dll" into the directory=
 "G:\PostgreSQL\8.3\lib"- I tried to load to function into PostgreSQL=
 with the command:CREATE FUNCTION count_person() RETURNS int<br=
 />     AS 'G:/PostgreSQL/8.3/lib/pgExampleSPI.dll', 'c=
ount_person'     LANGUAGE C STRICT;- =
and received the following error description:ERROR:  incom=
patible library "G:/PostgreSQL/8.3/lib/pgExampleSPI.dll": missing magic blo=
ckTIP:  Extension libraries are required to use the PG_MODULE_MA=
GIC macro.After searching google for about 5 hours in cou=
ldn't find a way to solve this problem.Can anybody help, please=
?<span style=3D"font-family: ve=
rdana,geneva;"><span style=
=3D"color: #000000;"><=
/span>  <table cellpadding=3D"0" cellspacing=
=3D"0" border=3D"0"><img src=3D"https://img.web=
.de/p.gif" width=3D"1" height=3D"1" border=3D"0" alt=3D"" /><=
td style=3D"font-family:verdana; font-size:12px; line-height:17px;">GRATIS =
für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!   J=
etzt freischalten unter http://movieflat.web.de

pgsql-general by date:

Previous
From: Norberto Delle
Date:
Subject: Autovacuum and pg_largeobject
Next
From: Greg Smith
Date:
Subject: Re: Postgresql partitioning - single hot table or distributed