Re: Load Dll from Embedded Resource
Quote:
Originally Posted by
TheCPUWizard
Not sure what you indend by this, can you please elaborate...
no static libraries. the effect of ILMerge is the same as a static library, tough implementation is different (so I think).
Quote:
Originally Posted by
TheCPUWizard
The MSIL is ALWAYS loaded in its entirity into memory for a given assembly, regardless of how much is actually used. You are correct about how much will be compiled (by JIT) into native code, regardless of the way in which the assembly is loaded.
true, but the native image (in its entirety) is not. that's all I meant.
Re: Load Dll from Embedded Resource
Another method is:
Code:
class CoffLoader {
private static void OnAssemblyLoad(object o, AssemblyLoadEventArgs args) {
Console.WriteLine("Loaded assembly {0}", args.LoadedAssembly);
}
public static void Main() {
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CoffAssembly.dll");
byte[] coffImage = new byte[stream.Length];
stream.Read(coffImage, 0, coffImage.Length);
AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoad);
Assembly coffAssembly = Assembly.Load(coffImage);
}
}
From: http://www.gamedev.net/community/for...opic_id=328884
Re: Load Dll from Embedded Resource
Quote:
Originally Posted by
darwen
I hate to be a killjoy here, but since it appears an interop assembly is being generated for a COM dll, the COM dll needs to be present and registered on the target machine regardless of whether the interop assembly is included in the resources of the app or not.
And Synctrllib doesn't seem to be in a standard windows dll (
what is synctrl.dll) so it'll need installing.
As far as I'm aware COM dlls cannot be loaded into memory and called by the interop assembly. The interop assembly will use the standard COM mechanism for instansiation of objects(CoCreateInstance etc) and therefore requires that the COM dll is present on the hard drive and the necessary registry keys have been created.
Darwen.
In properties, of a .dll you included in your project, if you set "Isolated = true" you can avoid registration, of that .dll, on the target system.