如果不是com,而是标准dll文件的话: class MyClass { [DllImport("StandardDll.dll",CharSet=CharSet.Auto,EntryPoint="IntTest")] static extern int Test(ref int a,ref int b); public static void Main() { int a = 10; int b = 2; int c = Test(ref a,ref b); Console.WriteLine(c); } }
class MyClass
{
[DllImport("StandardDll.dll",CharSet=CharSet.Auto,EntryPoint="IntTest")]
static extern int Test(ref int a,ref int b);
public static void Main()
{
int a = 10;
int b = 2;
int c = Test(ref a,ref b);
Console.WriteLine(c);
}
}
如果是标准dll,就和引用windows api一样了,楼上的兄弟写的挺清楚的
资深C#专业QQ群组11440220 ,拥有三个高级会员群组,已经汇集800多C#程序爱好者,欢迎大家加入!