[fpc-pascal] Firebird UDF

Michael Van Canneyt michael at freepascal.org
Thu Mar 13 09:52:22 CET 2008



On Thu, 13 Mar 2008, Codebue Fabio - P-Soft wrote:

> This is my UDF source 
> 
> library pudf; 
>   {$mode objfpc}{$H+} 
> uses 
>   Classes; 
> 
> function pround(var valore: real; ndec: integer):real;export; 
> var 
>   i: integer; 
>   risultato: real; 
>   ndivisore: integer; 
> begin 
>   risultato:= valore; 
>   ndivisore:= 1; 
>   for i:= 1 to ndec do 
>   begin 
>     risultato:= risultato*10; 
>     ndivisore:= ndivisore*10; 
>   end; 
>   result:= round(risultato)/ndivisore; 
> end; 
> 
> exports 
>   pround name 'pround'; 
> 
> begin 
> end. 
> 
> but after insert into my fdb with instruction 
> 
> DECLARE EXTERNAL FUNCTION pround 
> DOUBLE PRECISION, INTEGER 
> RETURNS DOUBLE PRECISION BY VALUE 
> ENTRY_POINT 'pround' MODULE_NAME 'pudf'; 
> 
> if I use it with an instruction like this 
> 
> select round(123.1233, 2) as nrounded from rdb$database 
> 
> I have back this error 
> 
> Invalid token. 
> invalid request BLR at offset 59. 
> function PROUND is not defined. 
> module name or entrypoint could not be found. 
> 
> do you have some idea regarding this error?

Where did you put the library, what is the library name ?

Michael.



More information about the fpc-pascal mailing list