2012-10-11 41 views
2

所以我有一个m文件,我使用Matlab编译器在C dll窗体中编译。注意编译后的dll文件最初是一个名为'matFunction.m'的matlab文件。现在我想要从我的matlab代码运行这个DLL。 _I正在做以下在matlab中运行一个在dll中编译的m文件

loadlibrary compiledDLL.dll compiledDLL.h 
calllib('compiledDLL','matfunction') 

,但我得到的是

Error using calllib 
Method not found 

我也用

loadlibrary compiledDLL.dll compiledDLL.h 
calllib('compiledDLL','matfunction.m') 

的错误,但我得到了同样的错误。有人能告诉我我做错了什么,以及如何在我的matlab代码中运行这个DLL。

+1

调用LoadLibrary是一个函数,不是吗?即'loadlibrary(dll,hfile)'?我可能是错的 –

+0

http://www.mathworks.com/help/matlab/ref/loadlibrary.html –

回答

0

loadlibrary是一个函数。正确的语法是

loadlibrary(dll,hfile) 

为每documentation.

的文件也明确规定调用的函数,如果库是在内存中已经加载。您可以使用

tf = libisloaded(libname) 

来测试库是否已经加载到内存中。

此外,使用calllib时,请确保您在适当的参数传递你的功能,以及:

[x1,...,xN] = calllib(libname,funcname,arg1,...,argN) 
相关问题