Search Postgresql Archives

Re: Dynamic loading of C functions: Badly stuck

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jun 21, 2006, at 9:42 AM, Jasbinder Bali wrote:

Hi,
I raised this problem yesterday aswell. I'm badly stuck at this point.
The problem is as follows:

I have a C function that i want to use in my postgres function.
I adopt the following steps to do that.

--- compile the C file as follows
     gcc -shared -o test_func.so test_func.c
     test_func.c is the name of the C file

--- the name of the function that i want to use from this c file is called 'command'

--- Postgres function is written as follows:

    CREATE FUNCTION command(integer) RETURNS integer
     AS 'usr/include/pgsql/server/test_func', 'command'
     LANGUAGE C STRICT;

when i try to run this function, always gives me the follwoing error:

ERROR: could not access file "usr/include/pgsql/server/test_func": No such file or directory


I tried changin the permission of the file to 666 and even tried it with 755 but in vein.

I checked the log file but it just prints the above error and doesn't give me any more information.

I have no clue why is postgres not reading test_func object file.

Any kind of help would be appreciated


IIRC the path name is relative to... dynamic_library_path and pwd, first
as given, then with ".so" appended.

Unless you've set one of those to "/" then 'usr/include/pgsql/server/ test_func'
is never going to resolve to where you want it to.

If you really want to keep it where it is, try using the correct absolute filename. Better, though, would be to use ... AS '$libdir/test_func.so' ... and put the library
wherever "pg_config --pkglibdir" says - probably /usr/local/pgsql/lib.

Cheers,
  Steve



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux