using System; using System.Runtime.InteropServices; namespace zzzili { class Test{ [DllImport("dllTest.dll")] public static extern int MyDll_Add(int a, int b); static void Main() { Console.WriteLine(MyDll_Add(1,2).ToString()); } } } dllTest.C extern "C" __declspec(dllexport) int MyDll_Add(int a,int b); int MyDll_Add(int a,int b) { return a+b; }