静态链接禁用优化,/OPT:NOREF /WHOLEARCHIV

2022-06-24  本文已影响0人  XBruce

显示加载指定的Api,即便linker suppose it was not used.
My current solution (hack?) is to use a Ruby script as a post build step on my libraries. This script uses the dumpbin.exe tool to find all symbols containing the word 'forceLink', and it outputs a header file containing

pragma comment(linker, "/include:symbol")

for each of the symbols. I then include that header file from my main project, and then everything just works.
Thanks to everybody suggesting the dumpbin+grep+pragma comment(linker,...) workaround.

#pragma comment(linker, "/include:symbol")

 #pragma comment(linker, "/include:?emptyreference@Noisy@@QAEXXZ")
上一篇下一篇

猜你喜欢

热点阅读