Re: Compiling a user C function in 7.2.1

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Compiling a user C function in 7.2.1
Дата
Msg-id 11547.1027876365@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Compiling a user C function in 7.2.1  (John Gunther <inbox@bucksvsbytes.com>)
Список pgsql-novice
John Gunther <inbox@bucksvsbytes.com> writes:
> Now I'm much further along: I have created a dynamic library
> (bvbpglib.so) containing one PostgreSQL C function (bvbpgsortword). This
> function calls a "regular" (non-PostgreSQL) C function (bvbmakesortstring).

> My current problem is that my psql statement:
> CREATE FUNCTION bvbpgsortword(TEXT) RETURNS TEXT AS
> '/usr/include/bvbpglib' LANGUAGE C WITH (ISSTRICT);
> fails with "undefined symbol: bvbmakesortstring"

> This is probably the result of some fundamental deficit in my
> understanding of C writing/compiling/linking, but what puzzles me is
> that bvbmakesortstring is called successfully from another C program I
> wrote. Only in psql does it come back undefined.

You have to make sure that the dynamic linker knows where to find the
library that contains bvbmakesortstring --- when one .so file depends
on another, the first one needs to be explicitly marked that way.

I think it would work to mention the other .so file as a library in
the link command for bvbpglib.so.

Try "ldd" on bvbpglib.so to see which libraries it's marked as needing,
and whether the dynamic linker knows where to find them.

            regards, tom lane

В списке pgsql-novice по дате отправления:

Предыдущее
От: John Gunther
Дата:
Сообщение: Re: Compiling a user C function in 7.2.1
Следующее
От: John Gunther
Дата:
Сообщение: Re: Compiling a user C function in 7.2.1