[fpc-pascal]UDF + FreePascal + Firebird 1.5

Guto gutojm at gmail.com
Sat Jul 24 18:20:40 CEST 2004


I believe, thats "cdecl", 
this is not explicit, and I get this example from
http://www.firebirdsql.org/index.php?op=useful&id=deatz_udf#linux

the function is:

int modulo(int *, int *);

int modulo(a, b)
     int *a;
     int *b;
{
  if (*b == 0)
    return -1;
  else
    return *a % *b;
}

and I compiled with:

gcc -c -O -fpic -fwritable-strings testec.c
ld -G <your udf>.o -lm -lc -o testec.so
cp testec.so /usr/local/firebird/UDF

and I declared with:

declare external function f_Modulo
  integer, integer
  returns
  integer by value
  entry_point 'modulo' module_name 'name of shared library';



On Sat, 24 Jul 2004 17:48:29 +0200 (CEST), Marco van de Voort
<marcov at stack.nl> wrote:
> > 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)...
> 
> How is the C stuff defined? With stdcall or cdecl?
> 
> > I believe thats a directive of something like that I must to use to
> > works in FreePascal.
> 
> Maybe it needs pic or so
> 
> 
> 
> _______________________________________________
> 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