Original Post
Hey! I got problems while loading a DLL file with c#. This is how the plugins are related: //Loader.exe //Loads an IEngine and an IApplication from DLL's //Engine.dll //Contains the following class:
public class CurrentEngine
{
public static IEngine Instance
{
get
{
m_instance = new CEngine();
}
}
}
public class CEngine : IEngine {
}
public interface IEngine {
}
So, I try to load the "Engine.dll" which goes just fine. Then I try to get the Property "Instance" from the "CurrentEngine" type. Works fine. Then I try to get the "get" method of the property, which goes just fine. Then I try to Invoke the get method, which also seems to be OK since no exception is thrown. And the returned object is not null. But then I try to do something like this in Loader.exe: //Engine.dll - CurrentEngine.Instance is stored into "loadedEngineObj" IEngine engine = (loadedEngineObj as IEngine); This gives me a null value. I have made sure the object created by CurrentEngine.Instance is derived from IEngine. I have also made sure to use the same IEngine.cs file in both the Engine.dll and the Loader.exe Seems like the types differ across the Loader.exe and Engine.dll. Does anyone know how to solve this? Thx!