Marco van de Voort schreef:
In our previous episode, Coco Pascal said:
I have a library with udf routines using the cdecl calling convention, required by Firebird. This seems to work well on win32.

How exactly?
?

function Y_Odd(const AValue: Int64): LongInt; cdecl; export;
begin
 if Odd(AValue) then
   Result := -1
 else
   Result := 0;
end; {Y_Odd}

exports

Y_Odd;

This works fine with Firebird. If I declare the stdcall calling convention Firebird can't find its entrypoint.

However when I test these routines with a fpc win32 app declaring external functions with the cdecl or stdcall calling convention gives me a 'entrypoint not found' error. I assume cdecl is obligatory, but can I implement that?

Maybe it is a matter of an underscore prefix. Write the declaration full
(cdecl external libname name '_symbol';

and experiment with leaving the underscore there or not.

It might also be the need to declare a libname. Windows and OS X afaik have 
separate
linker namespaces for external libs, so you need to declare the name of the
module they are in.
function Y_Odd(const AValue: Int64): LongInt; cdecl; external LibName name 'libyfbudf.dll';
gives me an  Identifier not found "LibName" error.

function Y_Odd(const AValue: Int64): LongInt; cdecl; external '_libyfbudf.dll';
gives me a File not found _libyfbudf.dll.



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to