ERROR: Could not find function

From: "Mark Miller" <mark(at)maxpreps(dot)com>
To: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: ERROR: Could not find function
Date: 2005-04-28 21:05:04
Message-ID: 20050428210800.EC58353731@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32

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

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Shelby Cain 2005-04-29 16:54:11 Re: Increasing statistics results in worse estimates
Previous Message Magnus Hagander 2005-04-27 10:50:33 Re: InstallShield and PostgreSQL