C#调用C++ 动态链接库DLL
2017-06-08 14:58
375 查看
自己摸索的 c#自己创建个类 申明调用方法 注意调用约定使用C默认调用约定
按钮事件调用
c++定义导出函数
源码:http://download.csdn.net/detail/srx942173347/9864655
public class CDLLFuntion { [DllImport(@"C:\Users\Administrator\Desktop\C#forC\CDLL\Debug\CDLL.dll", CallingConvention = CallingConvention.Cdecl)] public extern static int Add(int conn, int val); }
按钮事件调用
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(CDLLFuntion.Add(1, 2).ToString()); }
c++定义导出函数
extern "C" __declspec(dllexport) int Add(int plus1, int plus2) { int add_result = plus1 + plus2; return add_result; }
源码:http://download.csdn.net/detail/srx942173347/9864655
相关文章推荐
- C#调用C++动态链接库(dll)
- C#调用C/C++ 动态链接库DLL(三)
- C#调用C/C++动态链接库(.dll)详解
- C#调用C++动态链接库dll
- C#调用c++的标准动态链接库dll
- C#调用C/C++ 动态链接库DLL(二)
- C#调用c++的标准动态链接库dll
- C#调用C/C++动态链接库(.dll)详解
- C#调用C/C++ 动态链接库DLL(四) -- 调用C++类
- C#调用C++ 动态链接库dll
- C#调用C/C++ 动态链接库DLL(一)
- C# 调用 C++ dll 动态链接库中多个函数时全局变量的问题
- C#中调用C++ 动态链接库 dll 的方法
- C#调用C++编写的COM DLL封装库的问题解决方案
- C#中如何调用动态链接库DLL(转)
- C#动态调用C++DLL
- C# 中调用C++ DLL (P/Invoke)
- C#调用C++的DLL的
- c#调用c++写成的dll文件,返回char*,返回数组,用ref接收,byte[]
- 使用C++调用C#的DLL