How can I load a DLL file when my program is running?
(I'm using C# 2005 Express)
BTW the DLL is also written in C# 2005.
How can I load a DLL file when my program is running?
(I'm using C# 2005 Express)
BTW the DLL is also written in C# 2005.
Last edited by Mavix; 08-21-2007 at 06:48 AM. Reason: Added some more information
Not sure about C#, but in regular C/C++ it's:
Then you can get the functions in that by for example:Code:HMODULE h; h = LoadLibrary("somename.dll");
--Code:funcs.Init = (Init)GetProcAddress(h, "Init");
Mats
I think the best way is using Reflection.
OrCode:using System.Reflection; Assembly myAssembly = Assembly.LoadFrom(MyAssemblyName);
RegardsCode:using System.Reflection; Assembly myAssembly = Assembly.LoadFile(MyAssemblyPath);
Pete