I think as you know if you are linking against this library and you are not using dynamically linked runtime you might see weird behaviors or even crash (have no idea what's going on since it's not a coding issue). Recently I saw that if you are using MFC (for GUI) and you are using statiscally linked MFC DLL you will also see weird behavior.
What's a workaround for us to be able to integrate without issue with code that uses statically linked runtime (or MFC DLL)? If I create a DLL that uses Casablanca (thus using dynamic linking with runtime lib) and I load this DLL and use GetProcAddress of the API I want to call will this still cause any issue?
Issues:
1) licensing issues - can we distribute Microsoft runtime library freely and there are alot version of windows - that just increases testing.
2) this increases download size thus increase cost to host apps online.
3) this limit where you can use this library and how it can be used. You are effectively forcing a process to be dynamically linking the runtime libs in order to use this SDK. So for company that wants to integrate this SDK it would add an additional process in the system which is bad and then you need to use some sort of IPC so it can communicate with other processes. I mean for really simple projects you might be fine with one process doing everything but for more complex projects this is a deal breaker.
This has to be fixed as a critical bug and asap. This is a deal breaker in many instances. When will next VisualStudio be release?. I don't know if many people can wait until next year for this to support statically linked runtime library (unless there is a usable workaround).
Comments: I still got link errors using the instructions above - so here are mine that seem to work. I added 2 extra configurations rather than alter the ones provided. Also, I didn't rename the static libraries so that you can use the Debug and Release ones as generated. Create 2 new configurations - "Debug Static" based on "Debug" and "Release Static" based on "Release". Projects Casablanca120 & Casablanca120.xp Configuration Properties Debug Static & Release Static: General tab: Configuration Type: Static Library (.lib) Projects BingRequest120, BingRequest120.xp & SearchFile120 Debug Static: C/C++ Preprocessor tab: Add Preprocessor Definitions: _NO_ASYNCRTIMP Code Generation tab: Run Time Library: "Multi-threaded Debug (/MTd)" Linker: General tab: Additional Library Directories : $(OutDir) Input tab: Add Additional Dependencies: winhttp.lib & cpprest120d_2_0.lib Command Line tab: Additional Option: /NODEFAULTLIB:library Release Static: C/C++ Preprocessor tab: Add Preprocessor Definitions: _NO_ASYNCRTIMP Code Generation tab: Run Time Library: "Multi-threaded (/MT)" Linker: General tab: Additional Library Directories : $(OutDir) Input tab: Add Additional Dependencies: winhttp.lib & cpprest120_2_0.lib Command Line tab: Additional Option: /NODEFAULTLIB:library Projects BlackJack_Client120, BlackJack_Server120 & CasaLens120 - as above projects _plus an extra additional dependency_: Debug Static: Linker: Input tab: Add Additional Dependencies: winhttp.lib, cpprest120d_2_0.lib __AND__ httpapi.lib Release Static: Linker: Input tab: Add Additional Dependencies: winhttp.lib, cpprest120_2_0.lib __AND__ httpapi.lib
What's a workaround for us to be able to integrate without issue with code that uses statically linked runtime (or MFC DLL)? If I create a DLL that uses Casablanca (thus using dynamic linking with runtime lib) and I load this DLL and use GetProcAddress of the API I want to call will this still cause any issue?
Issues:
1) licensing issues - can we distribute Microsoft runtime library freely and there are alot version of windows - that just increases testing.
2) this increases download size thus increase cost to host apps online.
3) this limit where you can use this library and how it can be used. You are effectively forcing a process to be dynamically linking the runtime libs in order to use this SDK. So for company that wants to integrate this SDK it would add an additional process in the system which is bad and then you need to use some sort of IPC so it can communicate with other processes. I mean for really simple projects you might be fine with one process doing everything but for more complex projects this is a deal breaker.
This has to be fixed as a critical bug and asap. This is a deal breaker in many instances. When will next VisualStudio be release?. I don't know if many people can wait until next year for this to support statically linked runtime library (unless there is a usable workaround).
Comments: I still got link errors using the instructions above - so here are mine that seem to work. I added 2 extra configurations rather than alter the ones provided. Also, I didn't rename the static libraries so that you can use the Debug and Release ones as generated. Create 2 new configurations - "Debug Static" based on "Debug" and "Release Static" based on "Release". Projects Casablanca120 & Casablanca120.xp Configuration Properties Debug Static & Release Static: General tab: Configuration Type: Static Library (.lib) Projects BingRequest120, BingRequest120.xp & SearchFile120 Debug Static: C/C++ Preprocessor tab: Add Preprocessor Definitions: _NO_ASYNCRTIMP Code Generation tab: Run Time Library: "Multi-threaded Debug (/MTd)" Linker: General tab: Additional Library Directories : $(OutDir) Input tab: Add Additional Dependencies: winhttp.lib & cpprest120d_2_0.lib Command Line tab: Additional Option: /NODEFAULTLIB:library Release Static: C/C++ Preprocessor tab: Add Preprocessor Definitions: _NO_ASYNCRTIMP Code Generation tab: Run Time Library: "Multi-threaded (/MT)" Linker: General tab: Additional Library Directories : $(OutDir) Input tab: Add Additional Dependencies: winhttp.lib & cpprest120_2_0.lib Command Line tab: Additional Option: /NODEFAULTLIB:library Projects BlackJack_Client120, BlackJack_Server120 & CasaLens120 - as above projects _plus an extra additional dependency_: Debug Static: Linker: Input tab: Add Additional Dependencies: winhttp.lib, cpprest120d_2_0.lib __AND__ httpapi.lib Release Static: Linker: Input tab: Add Additional Dependencies: winhttp.lib, cpprest120_2_0.lib __AND__ httpapi.lib