Folow up : ERROR: Could not find function

From: dawizz <wwwillem(at)zonnet(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: Folow up : ERROR: Could not find function
Date: 2005-11-06 18:51:34
Message-ID: 200511061951.35065.wwwillem@zonnet.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Dear all,

After some advise I tried a couple of improvements
to my aprouch. With the next result:

I removed the "iostream.h" and "string.h" from my #include directives
And started compiling with gcc instead off g++ But still:

> ERROR: Could not find function 'runTest'  in file
'/usr/local/lib/funcTest.so'

I would be very thankfull if we can 'catch' my stupid error.

Here my steps ->

/* Next steps to compile_______________________________________________

Witch server engine?

$ pg_config --version
PostgreSQL 7.4.7

Determine configuration path;
--includedir -->> Print the location of C header files

$ pg_config --includedir-server
usr/include/postgresql/server

This is the compiler we use on a debian sarge installation;
$ gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)

The we compile it;
gcc -c -fPIC -isystem /usr/include/postgresql/server funcTest.cpp
gcc -shared -o funcTest.so funcTest.o

After the file .so is copied to the path /usr/local/lib
We check this entry in /etc/ld.so.conf
The file looks like: /usr/X11R6/lib
/usr/local/lib

Then we use ldconfig

#### NOTE> so file in /usr/local/lib is NOT mentioned by ldconfig --verbose

Then I use kpogre (1.3.5. on KDE 3.3.2) to parse the next SQL:
( and using libpqxx 2.3.4 )
CREATE FUNCTION test() RETURNS integer
AS '/usr/local/lib/funcTest.so', 'runTest'
LANGUAGE C STRICT;
*/

#include "postgres.h"
#include "fmgr.h"
// postgres syntax version 1.
PG_FUNCTION_INFO_V1(runTest);
Datum runTest(PG_FUNCTION_ARGS) {
// do something
int a;
a = 0;
PG_RETURN_INT32(a);
}

TANXS!!!!!!!!!! ;-)

With regards, Willem Greveling

Browse pgsql-novice by date

  From Date Subject
Next Message Jarkko Elfving 2005-11-07 15:17:45 Re: ERROR: column "datpath" does not exist
Previous Message Tom Lane 2005-11-06 16:42:49 Re: Using shared library's