c#调用c++dll
const string sdllPath = "TaskEdit.dll";
[DllImport(sdllPath)]
internal static extern IntPtr NewTask();
[DllImport(sdllPath)]
internal static extern IntPtr EditTask(string a, int b, int c, string d, string e, string f, string g);
[DllImport(sdllPath)]
internal static extern IntPtr ReadTask(string a, int b, int c, string d, string e, string f, string g);
[DllImport(sdllPath)]
internal static extern IntPtr GetTaskData(ref string a, ref int b, ref int c, ref string d, ref string e, ref string f, ref string g);
[DllImport(sdllPath)]
internal static extern IntPtr OpenANMapEdit(int nTaskId, string pcVersion, int nEditMode, int nWorkMode, string pcPicNo, string pcAdminNo, string pcRange, string pcPicLyer);
DllImport只接受常量const。那么我可以把dll的路径写到环境变量里并重新运行程序就可以找到了。(如用vs运行的话需要重启vs。)
posted on 2010-08-05 11:41 luckapple2 阅读(574) 评论(0) 编辑 收藏 举报