From: | Saitenheini(at)web(dot)de |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: C-functions using SPI Missing Magic Block Error |
Date: | 2010-07-02 15:13:23 |
Message-ID: | 1739244982.1343073.1278083603046.JavaMail.fmail@mwmweb050 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for reply Tom!
I've tried several version:
#define _USE_32BIT_TIME_T
#include "postgres.h"
#include "fmgr.h"
#include "executor\spi.h"
/*
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
*/
extern Datum count_person (PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(count_person);
__declspec(dllexport)
Datum count_person(PG_FUNCTION_ARGS) {
int32 ret;
SPI_connect();
ret = SPI_exec("SELECT count(*) FROM person", 0);
SPI_finish();
PG_RETURN_INT32(ret);
}
but still the same error occurs.
I also tried to include pgmagic.h, which I found in here:
http://archives.postgresql.org/pgsql-committers/2006-05/msg00369.php
http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/Attic/pgmagic.h?rev=1.1&content-type=text/x-cvsweb-markup
but this produces a compiler error:
G:\PostgreSQL\8.3\include\server\pgmagic.h|40|error: conflicting types for 'Pg_magic_struct'|
G:\PostgreSQL\8.3\include\server\fmgr.h|367|error: previous declaration of 'Pg_magic_struct' was here|
G:\PostgreSQL\8.3\include\server\pgmagic.h|45|error: conflicting types for 'PGModuleMagicFunction'|
G:\PostgreSQL\8.3\include\server\fmgr.h|383|error: previous declaration of 'PGModuleMagicFunction' was here|
G:\PostgreSQL\8.3\include\server\pgmagic.h|50|warning: "PG_MODULE_MAGIC" redefined|
G:\PostgreSQL\8.3\include\server\fmgr.h|388|warning: this is the location of the previous definition|
G:\PostgreSQL\8.3\include\server\pgmagic.h|66|warning: "PG_MODULE_MAGIC_DATA" redefined|
G:\PostgreSQL\8.3\include\server\fmgr.h|370|warning: this is the location of the previous definition|
||=== Build finished: 4 errors, 4 warnings ===|
I tried to build it in Visual C++ Express 2010 but compiler error occur (SPI_connect())
Any Idea to solve the problem ?
___________________________________________________________
WEB.DE DSL ab 19,99 Euro/Monat. Bis zu 150,- Euro Startguthaben und
50,- Euro Geldprämie inklusive! https://freundschaftswerbung.web.de
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2010-07-02 15:19:18 | Re: C-functions using SPI Missing Magic Block Error |
Previous Message | Chris Browne | 2010-07-02 15:05:16 | Re: Scheduling backup |