Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

The slight trickiness with this is that if you have any C/C++ libraries that you link into your application, then you need to static link those too. The problem with dynamically linking against a library while statically linking against VS runtime is that you basically end up with two or more copies of the runtime running at once in your application (e.g. two copies of any internal data structures used to manage memory with malloc/free/new/delete).

For similar reasons, you can't have static libraries that are used by higher-level dynamic libraries (e.g. gRPC dynamically linked with protobuf statically linked). In the end, the easiest solution is usually to pick static linking or dynamic linking and use it for everything, although it's possible not to if you're really careful.

Having said that, statically linking everything, including the Visual Studio runtime, works really well and I'd recommend it.



Always link statically whenever possible (looking at you mac os)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: