[fpc-pascal] Firebird UDF
Michael Van Canneyt
michael at freepascal.org
Thu Mar 13 10:23:35 CET 2008
On Thu, 13 Mar 2008, Codebue Fabio - P-Soft wrote:
> I create a pudf.dll library an put in UDF subdirectory of firebird
> installation (where you can find other UDFs)
>
> after this I use IBExpert to run the script
>
> DECLARE EXTERNAL FUNCTION pround
> DOUBLE PRECISION, INTEGER
> RETURNS DOUBLE PRECISION BY VALUE
> ENTRY_POINT 'pround' MODULE_NAME 'pudf';
>
> it run ok, I find another udf under functions category with paremeter set
> correctly
This is normal; the above just inserts a record in the metadata tables;
Nothing is checked. Can you try changing it to MODULE_NAME 'pudf.dll' ?
Michael.
>
> 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
>
> -----Original Message-----
> From: fpc-pascal-bounces at lists.freepascal.org
> [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Michael Van
> Canneyt
> Sent: Thursday, March 13, 2008 9:52 AM
> To: f.codebue at p-soft.biz; FPC-Pascal users discussions
> Subject: Re: [fpc-pascal] Firebird UDF
>
>
>
> 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.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
More information about the fpc-pascal
mailing list