[fpc-pascal] Smartlinking public functions
skalogryz.lists at gmail.com
Sat Mar 6 22:05:52 CET 2010
The system expects an application to implement (export) some functions
that are to be linked statically.
I'm using [public] modifier:
function someFunc: Integer cdecl; [public]; alias: '_someFunc';
The linker catches up the function and statically links it with the
The problem comes with using smartlinking -XX switch.
Since someFunc is not used by my code, the compiler considers it
useless and throws away.
The linker fails to find the symbol name and so a system routing, that
uses the exported functions, simply fails.
I can insert the usage code, like
if @someFunc = nil then Halt(255);
This would prevent the smartlinking, but is there more beautiful way
to prevent a function from being smartlinked?
More information about the fpc-pascal