[fpc-pascal] Exe size

Tomas Hajny XHajT03 at mbox.vol.cz
Tue Sep 9 00:01:12 CEST 2008


On 8 Sep 08, at 9:34, Paul wrote:

Hi Paul,

 .
 .
> I know KOL uses api calls (used it years ago), but I prefer to create my 
> forms, buttons etc. directly with api calls myself to keep the exe size as 
> small as possible.
> My problem is: how should I write api call's for a different target platform 
> , how are they interpreted by the crosscompiler, C-style or pascal-style...?

Let's assume that the used API calls would be those provided in unit 
Windows (the Win32 version if targetting i386-win32, or the WinCE 
version if targetting arm-wince). As long as these API calls are 
available on the given platform, you simply call them from the Pascal 
code using syntax defined in the interface part of unit Windows. 
Technically there's no difference between the native compilation and 
the cross-compilation, you just need to pass the right source code to 
the compiler with the right parameters specifying your target 
platform. The compiler automatically ensures that the right calling 
convention is used (as specified in unit Windows if referring to the 
API calls) and embeds the API calls into the machine code created for 
the target CPU. I'm not really sure what do you mean with "C style or 
Pascal style" - if this refers to calling conventions, they are the 
same for arm-wince as far as I know. Your source code would be 
obviously written in Pascal. The proper Pascal declarations may be 
found in the source code of unit Windows (interface part), but they 
should be mostly identical to those available with Delphi (in case 
you used that before).

Hope this helps

Tomas




More information about the fpc-pascal mailing list