[fpc-devel] Proposal: Supporting initial references for weakexternal

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Feb 15 19:31:40 CET 2011


On 15 Feb 2011, at 19:01, Jeppe Johansen wrote:

> What about allowing a new keyword "weak" and let it have two forms(something like you suggested back in one of the mails from 12th january)? Name mangling is an issue of course. It would be easiest to handle if weak symbols simply weren't name mangled(something like cdecl and co)

weakexternal can already be combined with cdecl. weak+external could also be combined with cdecl. As an aside, cdecl is not the same as "no mangling". It means "mangle the same as the C compiler", which varies from platform to platform.

> procedure TestProc; weak; // This produces a weak symbol
>  begin
>  end;
> 
> procedure TestProc2; weak default 'SomeDefaultFunction'; // Weak+default makes the declaration external by default
> procedure TestProc3; weak default 'SomeDefaultFunction'; external name 'Test_TestProc3'; // Overcome eventual name mangling problems. Symbol is called Test_TestProc3 and is linked to SomeDefaultFunction if not resolved at linktime
> procedure TestProc4; weak; external; // Replaces/does the same as weakexternal

I don't understand why you again propose to change the meaning of "external name 'xxx'" for weak symbols. As I mentioned in my previous mail, for consistency reasons something like that will not be done. I also don't see the advantage of inventing a new syntax ("weak default") when existing modifiers can already express the required semantics.


Jonas


More information about the fpc-devel mailing list