[fpc-pascal]UDF + FreePascal + Firebird 1.5

Guto gutojm at gmail.com
Sat Jul 24 16:41:03 CEST 2004


I tried with both, but I get the same error...

I wrote the same lib in C, and works fine, but I wouldnt like to
maintain a C version of all my libraries (actually written in
Delphi)...

I believe thats a directive of something like that I must to use to
works in FreePascal.

Any idea?

Thanks,
Guto

On Sat, 24 Jul 2004 16:21:23 +0200 (CEST), Marco van de Voort
<marcov at stack.nl> wrote:
> 
> 
> > I created a UDF, just to test and try to discovery what's wrong.
> > I ill explain what I did step by step.
> >
> > I created a teste.pas file like this:
> >
> > ----
> >
> > library teste;
> >
> > function intmax(a,b: Integer): Integer; stdcall; export;
> > begin
> >  if a>b then intmax:=a else intmax:=b;
> > end;
> >
> > exports
> >  intmax;
> >
> > end.
> >
> > ----
> >
> > I compile with freepascal:
> > fpc teste
> >
> > I moved to udf directory on firebird:
> > mv libteste.so /usr/local/firebird/UDF/
> >
> > I changed permissions:
> > cd /usr/local/firebird/UDF
> > chown firebird:firebird libteste.so
> > chmod 550 libteste.so
> >
> > I declared UDF:
> >
> > DECLARE EXTERNAL FUNCTION INTMAX
> >    INTEGER,
> >    INTEGER
> > RETURNS INTEGER BY VALUE
> > ENTRY_POINT 'intmax' MODULE_NAME 'teste';
> >
> > I test it:
> > select intmax(1,2) from rdb$database;
> >
> > And I got this error message:
> > Invalid token.
> > invalid request BLR at offset 60.
> > function INTMAX is not defined.
> > module name or entrypoint could not be found.
> >
> > Does anyone have any ideas?
> >
> 
> Are you 100% sure it doesn't have to be cdecl; instead of stdcall on *nix?
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 


-- 
Guto




More information about the fpc-pascal mailing list