1

My C++ (MFC) application is statically linked and loads a number of statically linked DLLs using LoadLibrary(). All had worked fine using VS2013 but since moving to VS2015 I have seen a number of strange _com_error exceptions being raised in a variety of locations.

In my test setup I have 56 DLLs being loaded and I see these exceptions. If I reduce this to 53 all seems to work fine.

I am assuming it is related to: Working around fls limitations with too many statically linked CRTs?

But what I am wondering is if something specific has changed from VS2013 to VS2015. I note a lot of work has been done on the CRT in this version of Visual Studio (https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/)

Note: I am compiling for Vista+ operating systems (_WIN32_WINNT_VISTA)

I can get things to work by recompiling the DLLs to use dynamic linking but was under the impression this is not a good idea if the main application is using static linking (I don't want to change this setting).

Community
  • 1
  • 1
Alastair Taylor
  • 345
  • 1
  • 3
  • 10
  • A _com_error exception has absolutely nothing to do with statically linked libraries. It is an exception that's raised by the wrapper code generated by the #import directive. Which imports a COM type library, the underlying server is always bound dynamically at runtime. So you are completely on the wrong track with this. Diagnose such an exception one at a time. Once you tackled three of them you probably found the real reason and you'll eliminate all of them. – Hans Passant Aug 23 '16 at 11:25
  • 1
    The _com_error exception Description() has "Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL) initialization routine failed." which led me to this thread: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/3546c3c4-1b36-4552-85c5-1b3ba860ee84/how-many-dlls-can-be-loaded-in-a-process-using-loadlibrary-?forum=windowssdk As I mentioned I can get it all working by loading a couple less DLLs. I am going to dig deeper. Many thanks for the reply. – Alastair Taylor Aug 23 '16 at 12:41

0 Answers0