pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alejandro Carrillo <fasterzip@yahoo.es>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Missing block Magic
Date: Tue, 5 Jun 2012 17:12:34 +0100 (BST)
Message-ID: <1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com> (raw)

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


view thread (3+ messages)  latest in thread

Message-ID: <1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com>
Permalink:  ../1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com/
Also on:    postgresql.org/message-id/1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: fasterzip@yahoo.es
  Subject: Re: Missing block Magic
  In-Reply-To: <1338912754.27056.YahooMailNeo@web171003.mail.ukl.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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