在matlab代码中使用dll文件 [英] Using a dll file in matlab code

查看:241
本文介绍了在matlab代码中使用dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用由dll文件定义的Matlab中的一个函数。我得到一个例子,那家伙把一个dll转换成mexw32文件,但我已经知道我是如何做到的。我尝试使用 loadlibrary ,但没有创建任何文件。
我该怎么做?

解决方案

loadlibrary 是MATLAB实现的<一个href =http://en.wikipedia.org/wiki/Foreign_function_interface =nofollow> FFI 服务,一种在外部共享库中调用函数的机制。它涉及在C类型和等效的MATLAB数据类型之间转换以传递数据。



MEX-files 也是一种动态链接的库(具有 .mex * extension),可以直接在MATLAB中作为常规函数运行,没有任何特殊的语法。



区别在于它有一个特定的网关例程,称为 mexFunction ,它收到输入和输出为 mxArray 类型。 mxArray 是在 mex.h 头文件中定义的不透明类型,它是所有MATLAB数据的基础类型。您通常使用 MEX库中的功能操作此数据API


I need to use a function in Matlab that is defined by a dll file. I got an example that guy converted a dll to mexw32 file but i have known how I do this. I tried use loadlibrary but it didn't create any file. How I can do this?

解决方案

loadlibrary is MATLAB's implementation of FFI services, a mechanism of calling functions in external shared libraries. It involves converting between C-types and their equivalent MATLAB data types to pass data around.

MEX-files are also a kind of dynamically linked libraries (with .mex* extension), that can be run directly in MATLAB as a regular function without any special syntax.

The difference is that it has a specific gateway routine called mexFunction, which receives both input and output as mxArray type. mxArray is an opaque type defined in mex.h header file, which is the fundamental type underlying all MATLAB data. You usually manipulate this data using functions in the MEX library API.

这篇关于在matlab代码中使用dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆