(完整 word)matlab 和 c++调用 DLL 方法
Matlab 和 C++调用 DLL 方法
Matlab 可以调用外部 DLL,如用 C 或 C++写的 DLL。本文分三个部分介绍
Matlab 和 C++调用 DLL 方法。
一、C++写 dll 方法
二、C++调用 dll
三、Matlab 调用 dll
一、C++写 DLL 方法
在 CPP 文件中和普通 CPP 没什么区别,在 H 文件中加上需要导出的函
数名,格式如下:
extern "C” int __declspec(dllexport)add(int x, int y);
蓝色部分是函数返回的类型,红色部分是要导出的函数,就这么简单。下
面是两个整数相加的代码:
main。h:
extern ”C” int __declspec(dllexport)add(int x, int y);
main。cpp:
#include ”main。h”
int add(int x, int y)
评论0
最新资源