I register my udfp with command

DECLARE EXTERNAL FUNCTION pround
  DOUBLE PRECISION, INTEGER
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT 'pudf_p_round'  MODULE_NAME 'pudf';

and test with this sql

select round(123.1233, 2) as nrounded from rdb$database 

returning error

Invalid token.
invalid request BLR at offset 59.
function PROUND is not defined.
module name or entrypoint could not be found.


I try to register with 
ENTRY_POINT 'p_round' or
MODULE_NAME 'pudf.dll'

nothing todo!!!

I have to set particular linker or compiler parameters?

Codebue Fabio
.-----------------------------.
  _ \       __|       _||
  __/____|\__ \  _ \  _| _|
 _|       ____/\___/_| \__|

P-Soft di Codebue Fabio & C. sas
via B.Storti, 19
24060 - Chiuduno - BG
Italy
Phone: +39.030.839435
Fax: +39.030.5100306
Mobile: +39.348.3515786
.-----------------------------.
Web  : www.p-soft.biz
EMail: [EMAIL PROTECTED]  

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephano
Sent: Thursday, March 13, 2008 8:09 PM
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] Firebird UDF

Codebue Fabio - P-Soft wrote:
> nothing todo...
> ok restart:
> library pudf;
> 
> {$mode objfpc}{$H+}
> 
> uses
>   Classes,
>   p_func in 'p_func.pas';
> 
> exports
>   pround name 'p_round';
> 
> {$R pudf.res}
> 
> begin
> 
> //  DECLARE EXTERNAL FUNCTION pround
> //   DOUBLE PRECISION, INTEGER
> //   RETURNS DOUBLE PRECISION BY VALUE
> //  ENTRY_POINT 'pudf_pround'  MODULE_NAME 'pudf';
> 
> end.                        
> 
> and
> 
> unit p_func;
> 
> {$mode objfpc}{$H+}
> 
> interface
>   function p_round(var valore: double; ndec: integer): double; cdecl;
> 
> implementation
> 
> uses
>   Classes, SysUtils;
> 
> function p_round(var valore: double; ndec: integer): double; cdecl;
> var
>   i: integer;
>   risultato: double;
>   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;
> end.       
> 
> someone can compile and install?
> 
> I can... but when I try to execute
> 
> select round(123.1233, 2) as nrounded from rdb$database
> 
> always some error!!!

You are exporting now the function as p_round. So I guess your entry 
point should be pudf_p_round.

Furthermore, your sql includes round and not pround!

What is the error message you got?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to