Visual Studio创建Matlab mex(dll)函数
来源:互联网 发布:爱晒儿软件博客 编辑:程序博客网 时间:2024/05/17 06:58
本文主要介绍在Windows
注意:本质上来讲mex和dll没有区别,只是两个不同的后缀名。Matlab2010b以后版本可能不支持调用dll为后缀的mex文件。消息来源如下
http://www.mathworks.com/help/techdoc/matlab_external/bsehn8g.html
A MEX-file is a shared library dynamically loaded at runtime. Shared libraries are sometimes called .dll files, for dynamically-linked library. MEX-files have a platform-dependent extension, which the mex function automatically assigns.
On 32-bit Windows platforms, the extension is .mexw32. MATLAB has supported .dll as a secondary MEX-file extension since Version 7.1 (R14SP3). In Version 7.7 (R2008b), if you used the -outputswitch to create a MEX-file with a .dll extension, MATLAB displayed a warning message that such usage is being phased out.
In MATLAB Version 7.10 (R2010a), you can no longer create a MEX-file with a .dll file extension. If you try to, MATLAB creates the MEX-file with the proper extension and displays the following warning:
Warning: Output file was specified with file extension, ".dll", which is not a proper MEX-file extension. The proper extension for this platform, ".mexw32", will be used instead.
MATLAB continues to execute a MEX-file with a .dll extension, but future versions of MATLAB will not support this extension.
本文参考如下网络资源
http://blog.sina.com.cn/s/blog_4d1865f00100o2ul.html
http://www.engineering.uiowa.edu/~dip/lecture/C++_with_Matlab.pdf
附录1 mexFunction.cpp
#include "mexFunction.h"
#include <string>
#include "stdlib.h"
#include <iostream>
using namespace std;
void mexFunction( int nlhs, mxArray *plhs[],int nrhs, const mxArray*prhs[] )
{
}
附录2 mexFunction.h
#include "matrix.h"
#include "mex.h"
#define TEST_MATLAB_3_EXPORTS
#ifdef TEST_MATLAB_3_EXPORTS
#define MEX_FUNCTION_API __declspec(dllexport)
#else
#define MEX_FUNCTION_API __declspec(dllimport)
#endif
MEX_FUNCTION_API void mexFunction(int nlhs, mxArray* plhs[],int nrhs, mxArray* prhs[]);
附录3 mexFunction.def
LIBRARY
EXPORTS
- Visual Studio创建Matlab mex(dll)函数
- visual studio 2010 创建 DLL
- matlab mex 函数使用
- Win7下Matlab中使用Visual Studio 2010编译Opencv的Mex文件
- 64位Mex文件在Matlab 2014b和Visual Studio 2013中的调试
- 64位Mex文件在Matlab 2014b和Visual Studio 2013中的调试
- mex 里面调用matlab函数
- dll动态库(一) Visual Studio创建dll动态库
- Visual Studio中调用matlab生成的dll
- MATLAB以MEX方式调用C/C++源代码(怎样写mex函数)
- Compiling a MEX file with Visual Studio
- 在Visual studio中生成.mex文件
- 【VS2010学习笔记】【编程实例】 (在Visual Studio中使用C++创建和使用DLL)
- 【VS2010学习笔记】【编程实例】 (在Visual Studio中使用C++创建和使用DLL)
- 使用visual studio 2017 创建动态链接库(DLL),供VB6.0使用
- Visual Studio 2008 创建dll 动态链接库
- Visual Studio 2008 创建dll 动 态链接库
- Visual Studio 2008 创建dll 动态链接库
- 一些与文件有关的函数
- W3C需要注意的一些问题
- C++ Virtual详解
- 代理模式
- 理解.NET中Thread.Sleep()方法(C#)
- Visual Studio创建Matlab mex(dll)函数
- 【.NET】继承,组合,聚合详解
- Rails Authentication with Devise and CanCan
- spring blazeds 安全配置
- 七年之痒
- 2012hold住
- const型类成员变量的初始化
- 2502
- Android系统名词解释汇总