Adriaan van Os wrote:
Is it correct that an external variable can be declared in GPC as follows:
var eV: integer; external; asmname 'eV';
Is there a similar construct to declare external constants ('extern const' in C) ?
Based on the grammar in parse.y, it looks like only Borland's static variable "constant" allows for external and asmname directives. But even that won't give you the semantics of C's extern const since it allows writes in addition to reads.
I think using your var declaration in conjunction with a protected export of "eV" will yield the correct result. Something like:
module test interface;
export C_external_constants = (protected eV);
var eV: integer; external; asmname 'eV';
end.
and then where you want to use the C extern const eV, just import the interface C_external_constants.
Gale Paeper gpaeper@empirenet.com