[fpc-devel]I suggest a new FPC feature

Pavel V. Ozerski pavel at insect.mail.iephb.ru
Tue Oct 9 10:19:08 CEST 2001

I wrote a patch to 1.1 (based on 03 oct 2001 sources) to support redefining of default calling conventions.
I see some reasons to implement this extension. 1) Some pascal sources contain assembler procedures/functions which
code is calling conventions-sensitive. Example: Key Objects Library (KOL) contains many assembler functions which
can work correctly only if register calling convention is used (I know that now FPC does not support this calling convention but
hope that it will support it in future). In such situations we must rewrite headers of all these procedures, that can be a big and
hard work. 2) If in future default calling conventions in FPC will be changed to register, you will must rewrite big parts of RTL.
It is evident that this work will require many steps, at initial stages most RTL functions will be remained stdcall. I think, you also
would avoid manuall adding to all these functions in RTL source 'stdcall' keyword.

My idea: support new compiler directive: {$Calling <calling_convention>}, e.g. {$calling cdecl} must change default calling conventions
of followed functions. Also new command line option, -Cc<calling_convention>, could be implemented.
Implementation of these features requered some changes in four units: pdecsub.pas, scandir.pas, globals.pas, options.pas.
I could send patched units to FPC team.

Sincerely, Pavel

P.S. Virtual Pascal supports similar feature ({&stdcall on} etc)

More information about the fpc-devel mailing list