因为机子上没有安装Visual Studio,所以找到了一种通过code::blocks编译dll的方式,踩到的坑是code::blocks默认的compiler是32位的,这样编译出的dll也是32位的,编译64位的需要借助MinGW-w64的toolchain. 为code::blocks配置外部MinGW-w64编译器可以参考Compile 64-bit under windows with MinGW-w64. 使用code::blocks创建一个dll的工程,如下图: go和next到
一.C#封装成DLL 1.在VS中创建项目选择类库,命名 myDll 2.建立好项目后自动生成的代码如下: 代码修改如下,添加自己要封装的C#代码,注意修饰符必须为public using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace myDLL { public class Class1 { //封装的DLL函数 public int add(int x, in