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

Jeppe Johansen jepjoh2 at es.aau.dk
Wed Jan 12 07:21:21 CET 2011


Den 12-01-2011 06:56, Paul Ishenin skrev:
> 12.01.2011 12:29, Jeppe Johansen wrote:
>> A short example:
>> procedure NoHandler;
>> begin
>> end;
>>
>> procedure TestProc; weakexternal name 'TestProc' set 'NoHandler';
>> ...
>> begin
>> TestProc; // This will call NoHandler
>> end.
>>
>> If we modify the example:
>> procedure NoHandler;
>> begin
>> end;
>>
>> procedure TestProcHandler; [public, alias: 'TestProc'];
>> begin
>> end;
>>
>> procedure TestProc; weakexternal name 'TestProc' set 'NoHandler';
>> ...
>> begin
>> TestProc; // This will call TestProcHandler
>> end.
>
> As I understand NoHandler will be called if we call a TestProc routine 
> but 'TestProc' symbol is is not found?
>
> If so then:
> a) NoHandler must have the same arguments and calling convention as 
> TestProc?
With this solution, no. This uses only symbol names
> b) What happen if NoHandler is not found?
Then TestProc cannot be resolved to any symbol, and will generate a weak 
undefined reference. Eg. it won't complain about an undefined reference



More information about the fpc-devel mailing list