On 01 Nov 2006, at 20:46, Frank Heckenbach wrote:
It would be more like an embedded foreign-language section (such as 'extern "C"' in C++, which is of course simplified by the fact that the syntax of C and a subset of C++ is very similar), but IMHO "external;" is not like this.
You're misunderstanding what I'm trying to say. The following:
procedure t; external;
and
procedure T; external;
are also equivalent (as I literally said in my original post). Just like it is in GPC. And I also said that they only become different if you add cdecl (or C in MacPas) mode, i.e.
procedure t; cdecl; external;
keeps the name 't' and
procedure T; cdecl; external;
keeps the name 'T'. But, and here's where the misunderstanding comes in, you can't have both with the same parameter list in one compilation unit because when calling them from Pascal code, the Pascal casing rules are applied (i.e., whether you write t or T later on, both resolve to one and the same identifier). Therefore this program:
*** Program test;
procedure t; cdecl; external; procedure T; cdecl; external;
begin end. ***
generates the error:
tt.pp(4,11) Error: overloaded functions have the same parameter list
I.o.w, the cdecl keeping the identifier casing only applies to the name used for external linkage, and not to the name(s) usable in the Pascal code.
Jonas