[fpc-pascal] Firebird UDF

Codebue Fabio - P-Soft f.codebue at p-soft.biz
Fri Mar 14 11:40:29 CET 2008


I learn about all your tips... but nothing todo. I try to summarize
I'm using firebird 2.0.3 in windows vista environment. pudf was compiled
with fpc 2.0.4 and created with lazarus 0.9.22
 
project file
 
     library pudf;

 
{$mode objfpc}{$H+}
 
uses
  Classes,
  p_func in 'p_func.pas';
 
exports
  p_round name 'p_round';
 
{$R pudf.res}
 
begin         
end.

function file
 

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.                                  

 
Declare command:
 
 
 
 
test commnand
 
select P_ROUND(123.1233, 2) as nrounded from rdb$database
 
 
error
 

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

 
 

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: f.codebue at p-soft.biz  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20080314/ac98f16d/attachment.html>


More information about the fpc-pascal mailing list