How to prevent the linker from optimizing away startup code?

后端 未结 2 1813
北荒
北荒 2021-01-14 12:19

I have the following problem: My (C++-)project consists of several subprojects. In each, I have several files with code I want to run at startup. My solution so far is to us

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-14 12:59

    Some trick, but review it. For Win system (but not linux) use explicit dllexport - in this case linker doen't knows if this symbol used by outer app or not.

提交回复
热议问题