ERROR: Could not find function
"Mark Miller" <[email protected]> Thu, 28 Apr 2005 14:05:04 -0700
| Newsgroups | gmane.comp.db.postgresql.devel.win32 |
|---|---|
| Organization | Waveshift, Inc. |
| Message-ID | <[email protected]> |
I have finally gotten everything compiled and all the headers installed. It
seems to be running fine thanks for all your help.
I am now trying to write an extension function. For my first try I copied
the following function out of the postgreSQL documentation:
#include "postgres.h"
#include "fmgr.h"
#include <string.h>
PG_FUNCTION_INFO_V1(add_one);
Datum add_one(PG_FUNCTION_ARGS)
{
int32 arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg + 1);
}
I created the following makefile:
MODULES = howto
override SHLIB_LINK += -L/usr/local/pgsql/lib -lpostgres
PGXS := $(shell pg_config --pgxs)
include $(PGXS)
ran make install and received the following output:
make install
g++ -I. -I/usr/local/pgsql/include/server
-I/usr/local/pgsql/include/internal -I./src/include/port/win32
-DEXEC_BACKEND
"-IC:/msys/1.0/local/pgsql/lib/pgxs/src/makefiles/../../src/include/port/win
32" -I/usr/local/pgsql/include/server/port/win32 -c -o howto.o howto.C
dlltool --export-all --output-def howto.def howto.o
dllwrap -o howto.dll --def howto.def howto.o
C:/msys/1.0/local/pgsql/lib/pgxs/src/makefiles/../../src/utils/dllinit.o
-L/usr/local/pgsql/lib -lpostgres
rm -f howto.def
/bin/sh.exe
C:/msys/1.0/local/pgsql/lib/pgxs/src/makefiles/../../config/install-sh -c -m
755 howto.dll /usr/local/pgsql/lib
rm howto.o
and then wrote the following function to call the extension function:
CREATE FUNCTION add_one(integer) RETURNS integer
AS 'howto', 'add_one'
LANGUAGE C STRICT;
But when I run the command to create the function I get the following error:
ERROR: could not find function "add_one" in file
"C:/msys/1.0/local/pgsql/lib/howto.dll"
Any idea why this doesn't work?
Thanks again,
Mark