Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...