11 hours ago

Try build a dynamic library, a lot function symbol and global symbol need to be deferred binding from runtime app.

It can be done by pass -Wl,-undefined,dynamic_lookup or --unresolved-symbols=dynamic_lookup to linker.

I am look a way to do it from d code, like pragma(linkerDirective, "--unresolved-symbols=dynamic_lookup"), this can be more flexable when I import one module, I get that module linker options. (there is a lot module they have diff symbol options, I need to combine them arbitrarily)

linux work since they allow undefined symbol when link dynamic library.

for macOS, with pragma(linkerDirective, "--unresolved-symbols=dynamic_lookup");, I get error:

lld: error: --unresolved-symbols=dynamic_lookup is not allowed in LC_LINKER_OPTION

I need to use llvm lld -flavor ld64.