Missing magic block - Mailing list pgsql-general

From Brad Buran
Subject Missing magic block
Date
Msg-id 004601c78530$eab8c310$0c05fa12@issphoenix
Whole thread Raw
Responses Re: Missing magic block  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
I'm trying to learn how to write custom extensions to postgres so wrote a
basic C function to see how it works.  However, I keep getting the following
error "Missing magic block" when I try to add the function to the database.
According to the documentation in the manual, all I need to do is add the
following:

#include "server/fmgr.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

To my C file and it will work.  However, I guess it is not working?  Below
is the source code:

#include "server/postgres.h"
#include <string.h>

#include "server/fmgr.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

int
add_one(int arg)
{
    return arg + 1;
}

And the sql statement I am using is:

CREATE FUNCTION add_one(IN int)
    RETURNS int
    AS 'add_one'
    LANGUAGE C;

Any feedback as to how to correct it is appreciated!
Thanks,
Brad


pgsql-general by date:

Previous
From: ptjm@interlog.com (Patrick TJ McPhee)
Date:
Subject: Re: can't start tsearch2 in 8.2.4
Next
From: Tom Lane
Date:
Subject: Re: can't start tsearch2 in 8.2.4