I've added a hosting interface to a native C++ application which instantiates the CLR, creates a custom appDomainManager, and provides calls to load managed assemblies into the native process. In my native C++ LoadDLL() function I was expecting to be able to test the incoming dll for .net vs C++ by calling LoadLibrary(dllPath) which I assumed would return failure (NULL) for managed assemblies, but I'm finding that it is returning a handle instead (this is with no CLR currently running in the unmanaged process). Is this normal behavior for an unmanaged LoadLibrary() call on a managed assembly?
I'm not sure I understand how LoadLibrary can even find a proper entry point to test in a managed assembly. I know (one possible) way to solve the problem, and the way I'm planning to implement, is simply to use the CLR instance to access the .net reflection APIs and check if the DLL is managed there first...but I'm puzzled by the fact that LoadLibrary() isn't returning failure and I'd like to understand what I'm missing here. Is the behavior undefined, should it always return a handle, or does it depend on the configuration of the managed assembly? Any link to references is appreciated.
Edit:
Question answered in comments, closing.