Entry point for C++/CLI x64 WindowsForms App (VS 2015)

白昼怎懂夜的黑 提交于 2019-11-28 11:35:02

问题


I have the same problem as the user in Visual Studio 2015 c++/CLI boost::thread : If I use boost, Windows Forms and C++/Cli together, my app crashes on startup.

The proposed solution works for me (change Subsystem to Console); the only small disadvantage is that the console is started alongside the GUI.

There is another solution I've found (see https://bytes.com/topic/net/answers/642179-c-cli-winforms-app-native-static-library-singletons-cra) : Changing the entry point to "?mainCRTStartupStrArray@@$$FYMHP$01AP$AAVString@System@@@Z".

However this only works when compiling for 32 bit; for 64 bit the symbol cannot be resolved. My questions:

  • Is there a similar symbol that works for x64 as well?
  • How could one find these kind of symbols? I tried to locate them via dumpbin but with no success!

回答1:


Ah, light at the end of the tunnel for this nasty ignored problem. You can find the correct mangled name by grepping the .lib files in vc/lib/amd64. Out pops msvcmrt.lib, the name is:

?mainCRTStartupStrArray@@$$FYMHP$01EAPE$AAVString@System@@@Z

Bit of a bug in the mangling algorithm btw, it shouldn't have added the extra E's because these are managed identifiers. Links and runs fine, I haven't tested yet if it solves the static initialization order fiasco problem. It is promising.



来源:https://stackoverflow.com/questions/41485935/entry-point-for-c-cli-x64-windowsforms-app-vs-2015

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!