Peter Gerwinski wrote:
- Have some extension to indicate C linkage (like C++ and
some C compilers do). Maybe an extension or alternative to the EXTERNAL keyword.
This already exists. See `info -f gpc -n "Other languages"'.
Procedure Foo; C; (* extern void foo ( void ); *) Procedure FooBar; asmname 'FooBar'; (* extern void FooBar ( void ); *)
I should mention that we're thinking about changing the syntax of external declarations and the internal names of Pascal identifiers soon.
In order to allow the same identifier in different units/modules (which is required by both the Standard and Borland Pascal and which GPC currently doesn't support), we need to change the "name mangling", anyway.
Instead of "Foobar" for an identifier `FooBar' declared in a unit/module `Baz', we could probably use `baz.foobar' (or `baz$foobar'), all lower-case, without risking name clashes with the libc.
For the external declarations, my suggestions is:
Procedure Foo; external; (* extern void foo ( void ); *)
(I.e., `external' will convert the name to lower-case, without the module name prefix.)
Procedure FooBar; external name 'FooBar'; (* extern void FooBar ( void ); *)
I've heard Delphi has something like this (`external' and `name'). Is it the same syntax, or what does it look like in Delphi?
BTW, we could then also have:
Procedure FooBar; name 'FooBar'; begin end;
to declare a Pascal procedure with a given internal name, instead of the "strange" form that is now necessary:
Procedure FooBar; asmname 'FooBar'; Procedure FooBar; begin end;
These are just ideas right now. Any comments?
Frank