martho
January 10th, 2007, 09:21 AM
Hello! I want to load an Assembly written in managed C++ with Assembly.Load and run it.
C#-Code:
Assembly a = Assembly.Load(bin);
MethodInfo method = a.EntryPoint;
object o = a.CreateInstance(method.Name);
String[] aStr = { };
Object[] aParam = { aStr };
method.Invoke(o, aParam);
I did a small example-exe in managed C++ to get loaded from this code. It works fine when the loaded .exe has been compiled with /clr:pure or /clr:save. When using an .exe compiled with /clr only, I got an exception in Assembly.Load: Unverifiable code failed policy check (exception from HRESULT: 0x80131402).
Has anyone a solution for this or is it just not possible to load an assembly compiled with /clr?
C#-Code:
Assembly a = Assembly.Load(bin);
MethodInfo method = a.EntryPoint;
object o = a.CreateInstance(method.Name);
String[] aStr = { };
Object[] aParam = { aStr };
method.Invoke(o, aParam);
I did a small example-exe in managed C++ to get loaded from this code. It works fine when the loaded .exe has been compiled with /clr:pure or /clr:save. When using an .exe compiled with /clr only, I got an exception in Assembly.Load: Unverifiable code failed policy check (exception from HRESULT: 0x80131402).
Has anyone a solution for this or is it just not possible to load an assembly compiled with /clr?