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 19:55:44
Message-ID: Pine.LNX.4.60.0502101251550.5503@frost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Thinking back I think i tried g++ first which caused the error to occur.
When i then tried cc the .so was already loaded.

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?

Seamus

On Thu, 10 Feb 2005, Tom Lane wrote:

> Seamus Thomas Carroll <carrolls(at)cpsc(dot)ucalgary(dot)ca> writes:
>> I changed my file from BlackboardFunctions.c to all lowercase,
>> blackboardfunctions.c, and the database now finds the add_one function.
>
> I'm betting that the actual sequence of events was more like this:
>
> CREATE FUNCTION f1(...) as '/home/.../BlackboardFunctions' ...;
> [ test f1, it works, cool ]
> [ add add_one to C source file, recompile ]
> CREATE FUNCTION add_one(...) as '/home/.../BlackboardFunctions' ...;
> [ fails ]
> [ rename file ]
> CREATE FUNCTION add_one(...) as '/home/.../blackboardfunctions' ...;
> [ works ]
>
> The reason the second try didn't work is that an existing backend will
> not re-load an already loaded .so file, unless you force it to with the
> LOAD command. It doesn't notice that you've modified the file. Had you
> started a fresh session, things would have worked, too.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2005-02-10 20:43:39 Re: Help with adding C-Language Functions
Previous Message Tom Lane 2005-02-10 17:31:13 Re: Help with adding C-Language Functions