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.
Printable View
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.
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