Re: Help with adding C-Language Functions

From: Seamus Thomas Carroll <carrolls(at)cpsc(dot)ucalgary(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Help with adding C-Language Functions
Date: 2005-02-10 23:17:11
Message-ID: Pine.LNX.4.60.0502101608560.5503@frost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi Tom,

I am trying to LOAD the .so file and i have replaced the add_one function(
this one compiled and tested after adding the extern "C"{}) with the
concat_text function.

It compiles but when i try the LOAD command i get the following error:
ERROR: could not load library "/home/grads/.../BlackboardFunctions.so":
/home/grads/.../BlackboardFunctions.so: undefined symbol: _Z16pg_detoast_datumP7varlena

I am guessing this has something to do with the varlena in c.h.

Seamus

On Thu, 10 Feb 2005, Tom Lane wrote:

> Seamus Thomas Carroll <carrolls(at)cpsc(dot)ucalgary(dot)ca> writes:
>> I have c++ classes i want to use but when i complile using g++ i get the
>> error (cant find function x in file.so). Does anyone have experience
>> compiling c++ and loading the function?
>
> The immediate problem is that you didn't declare the function as extern
> "C" so it doesn't follow C naming conventions. In general, though, it's
> fairly difficult to use any interesting C++ capabilities in a Postgres
> backend module, because the main backend does not contain the C++
> library. So, for instance, I'd not expect C++ exceptions or RTTI to
> work at all well.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2005-02-11 00:35:32 Re: Help with adding C-Language Functions
Previous Message Michael Fuhr 2005-02-10 22:15:05 Re: Function return number of affected rows