.Net 制作的DLL文件在.Net 中有两种调用方法:静态、动态调用
1、静态调用 在工程中添加引用即可使用
2、动态调用 采用Assembly来动态装入DLL中的配件
例:
Assembly clientassembly =
Assembly.LoadFrom(Application.StartupPath+@"\dll\CommInfoQuery.dll");
Form clientform =
(Form)clientassembly.CreateInstance("JHManage.CommInfoQueryForm");
clientform.Show();
1、静态调用 在工程中添加引用即可使用
2、动态调用 采用Assembly来动态装入DLL中的配件
例:
Assembly clientassembly =
Assembly.LoadFrom(Application.StartupPath+@"\dll\CommInfoQuery.dll");
Form clientform =
(Form)clientassembly.CreateInstance("JHManage.CommInfoQueryForm");
clientform.Show();
using System.Text;[DllImport("a.dll", EntryPoint="test",
CallingConvention=CallingConvention.StdCall)]
public static extern int test(StringBuilder msg);