显示加载指定的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")
网友评论