Using shared library's

From: dawizz <wwwillem(at)zonnet(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: Using shared library's
Date: 2005-11-06 11:25:37
Message-ID: 200511061225.37536.wwwillem@zonnet.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Dear all,

Recently I started digging into PosgreSQL programming.
I'm using a debian sarge kernel, KDE desktop and more.
G++ is used while compiling.

Next piece of code (funcTest.cpp):

#include "postgres.h"
#include <string.h>
#include "fmgr.h"
#include <iostream>
using namespace std;

// postgres syntax version 1.
PG_FUNCTION_INFO_V1(runTest);

Datum runTest(PG_FUNCTION_ARGS) {
// do something
int a;
a = 0;
PG_RETURN_INT32(a);
}

I compiled into a so file, on the prompt I used:

>> $ g++ -c -fPIC -isystem /usr/include/postgresql/server funcTest.cpp
>> $ g++ -shared -o funcTest.so funcTest.o

Then with the SQL syntax:

CREATE FUNCTION test() RETURNS integer
AS '/lib/funcTest.so', 'runTest'
LANGUAGE C STRICT;

and I get the error message:

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

As far as I can tell the library should be OK? I used commands like file, nm
and readelf..... But then again....

Does anyone has a good sugestion? Adn how about the fact that type Datum is
used?

With kind regards, Willem Greveling.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-11-06 16:27:45 Re: ERROR: column "datpath" does not exist
Previous Message Jarkko Elfving 2005-11-06 10:35:39 Re: ERROR: column "datpath" does not exist