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

Paul Ishenin ip at kmiac.ru
Wed Jan 12 10:54:18 CET 2011

12.01.2011 16:34, Florian Klaempfl пишет:

> Is the current solution of using procedure variables so bad? Or what
> does it lack?

I see the next benefits from WeakExternal:

1. Less accidental errors. Which procedural variables you need to care 
about the initial assignment to nil, then to use correct LoadLibrary 
handle, then you should not forget to FreeLibrary.

2. Less code to write - you don't need an initialization, finalization code.

3. Someone can accidentally reassign your procedural variable to 
something else.

4. I don't know exactly how this work but suspect that if your call 
failed because you don't have some routine in an external library then 
you can update the library without relaunching an application and the 
second call to this routine will not fail. I can be wrong regards this 
but as I understand this weak linking works on os level so some magic 
can be applied.

Best regards,
Paul Ishenin

More information about the fpc-devel mailing list