[Lazarus] Free Pascal / Lazarus calling conventions

Sven Barth pascaldragon at googlemail.com
Mon Feb 29 17:13:46 CET 2016


Am 29.02.2016 16:04 schrieb "Chavoux Luyt" <chavoux at gmail.com>:
>
>
> Hi guys,
>
> Just a stupid question, but is the Lazarus calling conventions documented
anywhere? Is it different from Delphi calling conventions? When calling
external c functions from libraries, does one need any special declarations
like in Delphi to tell it to use c-style calling conventions?

The register calling convention on i386 should be the same as Delphi's. The
others (cdecl, stdcall, pascal) are implemented in a compatible way as
well. On other platforms there is only one calling convention (exceptions
on e.g. Amiga aside) which is the platforms default calling convention.

>
> Related (it was actually Bo's question that got me thinking about this...
how easy/difficult would it be to write Linux drivers in Object Pascal, but
in a way that C/C++ programs can also use it? Or for that matter (since
Lazarus has been ported to Haiku) it might be easier to write drivers for
Haiku in Pascal rather than C? Maybe speed things up a bit?

For driver development in kernel mode you'll more often than not need a
completely custom RTL. Exceptions would only be micro kernel system of
which drivers are user mode processes as well and user mode driver
frameworks.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160229/fdd38cb9/attachment-0003.html>


More information about the Lazarus mailing list