crystal icon indicating copy to clipboard operation
crystal copied to clipboard

Linking against the debug MSVC runtime libraries

Open HertzDevil opened this issue 4 months ago • 0 comments

Currently, the Crystal runtime links against msvcrt / ucrt / vcruntime for dynamic builds on Windows, and libcmt / libucrt / libvcruntime for static builds. It would be great if Crystal could also link against the debug versions of those libraries, the ones with an extra d at the end of their names, corresponding to the /MTd and /MDd VC++ compiler flags. (Actually, llvm_ext.cc already uses this.) This would turn on assertions and allow the user to attach a debugger in case of an assertion failure:

LibC._close(-1)

image

Note however that these debug builds are not redistributable, so combining this feature into --debug might not be the best idea, and instead we should spare a new flag like -Dmsvc_debug.

HertzDevil avatar Feb 20 '24 12:02 HertzDevil