To support C++/CLI libraries in .NET Core, ijwhost was created as a shim for finding and loading the runtime. All C++/CLI libraries are linked to this shim, such that ijwhost.dll is found/loaded when the C++/CLI library is loaded.
By default, Windows' DLL search will look for dependencies of a DLL as if they were loaded with just the module name. This means that, depending on how a host application loads the C++/CLI library, the C++/CLI library may fail to load due to ijwhost.dll not being found. In order for the load to work one of the following needs to be true:
ijwhost.dll is on the search path
- the host applications specifies either
LOAD_WITH_ALTERED_SEARCH_PATH or LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR flags for LoadLibrary such that dependencies are searched for in the same directory as the C++/CLI library
C++/CLI libraries cannot dictate how their hosts load them and authors should not need to be concerned with how the ijwhost shim is found and loaded. The runtime/tooling should make the usage of ijwhost hidden to the user such that it just works without user intervention.
In .NET Framework, the equivalent shim (mscoree/mscoreei) is system-wide, so this was not an issue.
Potential options:
- Make
ijwhost a static library that gets linked into the C++/CLI library
- ?
@jkoritzinsky @AaronRobinsonMSFT @vitek-karas
To support C++/CLI libraries in .NET Core,
ijwhostwas created as a shim for finding and loading the runtime. All C++/CLI libraries are linked to this shim, such thatijwhost.dllis found/loaded when the C++/CLI library is loaded.By default, Windows' DLL search will look for dependencies of a DLL as if they were loaded with just the module name. This means that, depending on how a host application loads the C++/CLI library, the C++/CLI library may fail to load due to
ijwhost.dllnot being found. In order for the load to work one of the following needs to be true:ijwhost.dllis on the search pathLOAD_WITH_ALTERED_SEARCH_PATHorLOAD_LIBRARY_SEARCH_DLL_LOAD_DIRflags forLoadLibrarysuch that dependencies are searched for in the same directory as the C++/CLI libraryC++/CLI libraries cannot dictate how their hosts load them and authors should not need to be concerned with how the
ijwhostshim is found and loaded. The runtime/tooling should make the usage ofijwhosthidden to the user such that it just works without user intervention.In .NET Framework, the equivalent shim (
mscoree/mscoreei) is system-wide, so this was not an issue.Potential options:
ijwhosta static library that gets linked into the C++/CLI library@jkoritzinsky @AaronRobinsonMSFT @vitek-karas