Subject | Re: [firebird-support] UDF + FreePascal + Firebird 1.5 |
---|---|
Author | Jacqui Caren |
Post date | 2004-07-26T08:06:55Z |
Guto wrote:
* setting the 'RootDirectory = /opt/firebird
* uncommenting the 'UdfAccess = Restrict UDF' line
My UDFs would not work until I had did both modifications
(applied in the order shown). You should not require the
latter but it does not hurt to explicitly configure things.
RETURNS parameter 2 BY VALUE
if you get junk values returned.
If this is on linux try
nm -g teste.so | grep -i intmax
which should show you the name of the entry point
(on the line of the form ' T intmax')
within the .so (hint: some compilers can append a prefix).
If no such line exists then your function is not in the .so.
If the name has a prefix such as p_intmax then try changing
the entry point to this and see what happens.
Jacqui
> I created a UDF, just to test and try to discovery what's wrong.Did you enable UDF's by
> 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:
* setting the 'RootDirectory = /opt/firebird
* uncommenting the 'UdfAccess = Restrict UDF' line
My UDFs would not work until I had did both modifications
(applied in the order shown). You should not require the
latter but it does not hurt to explicitly configure things.
> DECLARE EXTERNAL FUNCTION INTMAXHint: try
> INTEGER,
> INTEGER
> RETURNS INTEGER BY VALUE
RETURNS parameter 2 BY VALUE
if you get junk values returned.
> ENTRY_POINT 'intmax' MODULE_NAME 'teste';To ensure that the error message is incorrect.
If this is on linux try
nm -g teste.so | grep -i intmax
which should show you the name of the entry point
(on the line of the form ' T intmax')
within the .so (hint: some compilers can append a prefix).
If no such line exists then your function is not in the .so.
If the name has a prefix such as p_intmax then try changing
the entry point to this and see what happens.
Jacqui