[fpc-pascal] Firebird UDF
zaher dirkey
parmaja at gmail.com
Thu Mar 13 11:44:29 CET 2008
try to add "cdecl"
| function pround(var valore: real; ndec: integer):real; cdecl; export;
On Thu, Mar 13, 2008 at 11:43 AM, Codebue Fabio - P-Soft <
f.codebue at p-soft.biz> wrote:
> I try with pudf.dll module name, I try to change function name ... I try a
> lot of things...
> sigh a so stupid UDF, and I can't create it...
>
> mmm
>
> 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
>
> sigh!
>
>
> 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 10:24 AM
> To: FPC-Pascal users discussions
> Subject: RE: [fpc-pascal] Firebird UDF
>
>
>
> 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
> >
> _______________________________________________
> 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
>
--
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20080313/f63a5115/attachment.html>
More information about the fpc-pascal
mailing list