[fpc-devel] New rules for External
Jonas Maebe
jonas at zeus.ugent.be
Fri Nov 26 19:52:39 CET 2004
On 26 nov 2004, at 19:36, Peter Vreman wrote:
>> But e.g.
>> gcc -c -o test.ow test.c
>> produces identifiers *without* "_"-prefix
>
> That is why you also can use "external name 'namewithoutunderscore'"
That's not entirely correct. If gcc adds an underscore to the start of
symbol names by default on the target we're compiling for, then FPC
will also add an underscore if you use something like this:
procedure test; cdec; external name 'test';
The reason is that otherwise such declarations become unportable and
require ifdef's depending on whether or not the target platform uses an
underscore by default. If you don't make the routine "cdecl", then the
underscore will never be added of course (but then the routine also
won't follow C calling conventions).
Jonas
More information about the fpc-devel
mailing list