crosire / blink

A tool which allows you to edit source code of any MSVC C++ project live at runtime
BSD 2-Clause "Simplified" License
1.09k stars 81 forks source link

Support for exceptions #31

Open mottosso opened 4 years ago

mottosso commented 4 years ago

Hi @crosire,

This isn't a bug report, I just wanted to document that exceptions don't appear to be supported by blink (?)

I'm initially had issues with VS2019 but luckily found #30 which got me half-way there, except the default "Console Application" preset in VS comes with exceptions enabled, which prompts the following error.

Unresolved external symbol '?uncaught_exception@std@@YA_NXZ'.
Full output ```bash $ blink.exe ConsoleApplication1.exe Launching in target application ... Entry point was written to address 000001B91B9D0000 Reading PE import directory ... Reading PE debug info directory ... Found program debug database: C:\Users\marcus\source\repos\ConsoleApplication1\x64\Debug\ConsoleApplication1.pdb Found source file: C:\Users\marcus\source\repos\ConsoleApplication1\ConsoleApplication1.cpp Starting compiler process ... Started process with PID 14996 Starting file system watcher for 'C:\Users\marcus\source\repos\ConsoleApplication1' ... Detected modification to: C:\Users\marcus\source\repos\ConsoleApplication1\ConsoleApplication1.cpp ConsoleApplication1.cpp Finished compiling "C:\Users\marcus\source\repos\ConsoleApplication1\ConsoleApplication1.temp.obj" with code 0. Unresolved external symbol '?uncaught_exception@std@@YA_NXZ'. The target application has exited with code 3221225786. ^C ```

Initially I suspected that maybe blink needs to be built with exceptions in order to support it, but it already was. Turning off C++ exceptions for the console application solved it.

image

crosire commented 4 years ago

Exceptions themselves should not be a problem. But VC++ 2019 (in contrast to 2017) isn't working particularly well out of the box with blink, because of the reason noted in #30. You'll likely have to set up a compiler command-line matching your project here and rebuild blink: https://github.com/crosire/blink/blob/fc5811a9e3b3263932528057baf480982226e675/source/blink.cpp#L386

mottosso commented 4 years ago

It all boils down to 2019. Can't make any promises, but I'll see if there's anything I could do to resolve this. Blink has been fantastic so far, despite the minor issues so thanks for that!