Re: Missing magic block - Mailing list pgsql-general

From Mario Munda
Subject Re: Missing magic block
Date
Msg-id 1178827233.440481.189560@y80g2000hsf.googlegroups.com
Whole thread Raw
In response to Missing magic block  ("Brad Buran" <bburan@MIT.EDU>)
Responses Re: Missing magic block
List pgsql-general
"Brad Buran" je napisal:
> Hi Martijn,
>
> Thank you very much for the suggestion:
>
> > > CREATE FUNCTION add_one(IN int)
> > >     RETURNS int
> > >     AS 'add_one'
> > >     LANGUAGE C;
>
> I corrected this to say:
>
>     AS 'Project1', 'add_one'
>
> And restarted psql (rebooted for that matter as well) and am still getting
> the same error.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

The same problem with me.

-- test_func.c

#include <postgres.h>
//#include <executor/spi.h>
//#include <commands/trigger.h>
#include <fmgr.h>
//#include <access/heapam.h>
#include <utils/syscache.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_type.h>
#include "pgmagic.h"

PG_FUNCTION_INFO_V1(plsample_call_handler);

Datum plsample_call_handler(PG_FUNCTION_ARGS)
{
    Datum          retval;

 //       retval = ...

    return retval;
}

I had to comment some includes out, or else i get some errors.

-- pgmagic.h

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

-- this is my makefile

all: gen_code.c
        g++ -fpic -I/usr/local/include -I/usr/local/include/postgresql/
server/ -c test_func.c
        g++ -shared -o test_func.so test_func.o

This is what psql returns (phppgadmin):

SQL error:

ERROR:  incompatible library "/home/mario/tests/psql_c_func/
test_func.so": missing magic block
HINT:  Extension libraries are required to use the PG_MODULE_MAGIC
macro.

In statement:
CREATE FUNCTION "plsample_call_handler" () RETURNS void AS '/home/
mario/tests/psql_c_func/test_func.so','plsample_call_handler' LANGUAGE
"C"

I have allready lost four hours for this. What is the problem??

P.S.:
select version() returns:

PostgreSQL 8.2.0 on i386-unknown-freebsd6.1, compiled by GCC gcc (GCC)
3.4.4 [FreeBSD] 20050518

Thanks in advance.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Views- Advantages and Disadvantages
Next
From: Christian Rolle
Date:
Subject: schema of system tables