Subject | UDF + FreePascal + Firebird 1.5 |
---|---|
Author | Guto |
Post date | 2004-07-24T18:48:35Z |
I created a UDF, just to test and try to discovery what's wrong.
I ill explain what I did step by step.
I created a teste.pas file like this:
----
library teste;
function intmax(a,b: Integer): Integer; stdcall; export;
begin
if a>b then intmax:=a else intmax:=b;
end;
exports
intmax;
end.
----
I compile with freepascal:
fpc teste
I moved to udf directory on firebird:
mv libteste.so /usr/local/firebird/UDF/
I changed permissions:
cd /usr/local/firebird/UDF
chown firebird:firebird libteste.so
chmod 550 libteste.so
I declared UDF:
DECLARE EXTERNAL FUNCTION INTMAX
INTEGER,
INTEGER
RETURNS INTEGER BY VALUE
ENTRY_POINT 'intmax' MODULE_NAME 'teste';
I test it:
select intmax(1,2) from rdb$database;
And I got this error message:
Invalid token.
invalid request BLR at offset 60.
function INTMAX is not defined.
module name or entrypoint could not be found.
Does anyone have any ideas?
Thanks in advance,
Guto
PS: I tried with "cdecl" and "stdcall" and happens the same
I ill explain what I did step by step.
I created a teste.pas file like this:
----
library teste;
function intmax(a,b: Integer): Integer; stdcall; export;
begin
if a>b then intmax:=a else intmax:=b;
end;
exports
intmax;
end.
----
I compile with freepascal:
fpc teste
I moved to udf directory on firebird:
mv libteste.so /usr/local/firebird/UDF/
I changed permissions:
cd /usr/local/firebird/UDF
chown firebird:firebird libteste.so
chmod 550 libteste.so
I declared UDF:
DECLARE EXTERNAL FUNCTION INTMAX
INTEGER,
INTEGER
RETURNS INTEGER BY VALUE
ENTRY_POINT 'intmax' MODULE_NAME 'teste';
I test it:
select intmax(1,2) from rdb$database;
And I got this error message:
Invalid token.
invalid request BLR at offset 60.
function INTMAX is not defined.
module name or entrypoint could not be found.
Does anyone have any ideas?
Thanks in advance,
Guto
PS: I tried with "cdecl" and "stdcall" and happens the same