Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
571 views
in Technique[技术] by (71.8m points)

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

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!
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...