Subject | Writing UDF for Linux |
---|---|
Author | Milan Babuskov |
Post date | 2002-11-07T15:56:52Z |
I'm trying to learn how to write UDF funcions for Linux, but fail at
first steps. I read this document on ibphoenix:
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_howto2
And followed the instructions from the example. Compiling the file
went ok:
gcc -c -O -fpic -fwritable-strings modulo.c
ld -G modulo.o -lm -lc -o modulo.so
cp modulo.so /opt/interbase/UDF
I run RH7, and the Firebird is installed in /opt/interbase, which has
UDF directory with all letters uppercase, so I copied the .so file
there. (Later I thought this may be the problem, and I copied the .so
file to lib also, and also created udf directory (lowercase) and made
one copy there also)
Then I declared the udf with the query from article:
declare external function f_Modulo
integer, integer
returns
integer by value
entry_point 'modulo' module_name 'modulo';
commit;
So far, so good. But when I try:
select f_Modulo(3, 2) from rdb$database;
I get:
Invalid request BLR at offset 60
function F_MODULO is not defined
module name or entry point could not be found
I also tried renaming file to modulo (without extension), but it
didn't work. What am I doing wrong here? Is there a way to check where
the database looks for .so file?
TIA
Milan.
first steps. I read this document on ibphoenix:
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_howto2
And followed the instructions from the example. Compiling the file
went ok:
gcc -c -O -fpic -fwritable-strings modulo.c
ld -G modulo.o -lm -lc -o modulo.so
cp modulo.so /opt/interbase/UDF
I run RH7, and the Firebird is installed in /opt/interbase, which has
UDF directory with all letters uppercase, so I copied the .so file
there. (Later I thought this may be the problem, and I copied the .so
file to lib also, and also created udf directory (lowercase) and made
one copy there also)
Then I declared the udf with the query from article:
declare external function f_Modulo
integer, integer
returns
integer by value
entry_point 'modulo' module_name 'modulo';
commit;
So far, so good. But when I try:
select f_Modulo(3, 2) from rdb$database;
I get:
Invalid request BLR at offset 60
function F_MODULO is not defined
module name or entry point could not be found
I also tried renaming file to modulo (without extension), but it
didn't work. What am I doing wrong here? Is there a way to check where
the database looks for .so file?
TIA
Milan.