سلام به همه
dynamically load a native dll from a user specified directory
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllname);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
public static extern IntPtr GetProcAddress(IntPtr loadeddll, string funnam);
delegate void dl(int x, int y);
static void Main()
{
IntPtr x=LoadLibrary("kernel32.dll");
IntPtr y=GetProcAddress(x,"Beep");
Delegate function = Marshal.GetDelegateForFunctionPointer(y, typeof(dl));
dl f= (dl)function;
f(44, 100);
}