Обсуждение: dynamically loaded functions

Поиск
Список
Период
Сортировка

dynamically loaded functions

От
TJ O'Donnell
Дата:
I've written some c-functions which depend on my code (gnova.so)
as well as a third-party library of functions (oe_chem.so).
Up until now, I've been preloading (in postgresql.conf) both .so's
and it all works fine.  To make it easier for my users to install my stuff,
I'd like to avoid the preloading, but this would
require giving 2 .so names in the CREATE FUNCTION statement (I imagine).
So, what I would like to do is something like this:

CREATE or REPLACE FUNCTION cansmiles(varchar) RETURNS varchar   AS 'gnova,oe_chem', 'oe_cansmiles' LANGUAGE 'c'
IMMUTABLESTRICT;
 

but I get this:
ERROR:  could not access file "gnova,oe_chem": No such file or directory

What I'm doing now:
CREATE or REPLACE FUNCTION cansmiles(varchar) RETURNS varchar   AS 'gnova', 'oe_cansmiles' LANGUAGE 'c' IMMUTABLE
STRICT;
requires preloading of oe_chem.so to work.

Is there any way I can associate oe_cansmiles with 2 .so's without
preloading?

More info:
oe_cansmiles is in gnova.so, but there are functions
in gnova.so that are in oe_chem.so.

TJ


Re: dynamically loaded functions

От
Michael Fuhr
Дата:
On Mon, Jul 11, 2005 at 08:16:17PM -0700, TJ O'Donnell wrote:
>
> CREATE or REPLACE FUNCTION cansmiles(varchar) RETURNS varchar
>    AS 'gnova', 'oe_cansmiles' LANGUAGE 'c' IMMUTABLE STRICT;
> requires preloading of oe_chem.so to work.
> 
> Is there any way I can associate oe_cansmiles with 2 .so's without
> preloading?

It sounds like you need to link gnova.so against the other shared
objects so the runtime linker can find them.  For examples, see the
Makefiles used by contributed modules like dblink, xml2, and a few
others that link against external libraries.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/