求助!!!labview调用matlab的dll文件出现报错~~请高手帮忙~~谢谢!!!
将matlab的m文件编译成dll文件,并用labview调用此dll文件,运行程序时出现下述报错“LabVIEW: 调用库函数节点调用的外部节点中出现一个意外。可能引起LabVIEW内存损坏。在新位置保存工作并重启LabVIEW。”
检查了输入输出参数设定,并没有错误。m文件在matlab中也能正常运行。不知报错是什么原因??请高手帮助解答~谢谢!!! 帮你顶下~~~不过你还是先把代码附上来 好的~
这是m文件的代码
function y=case1(x)
y=x+1;
这是封装dll文件的代码
mbuild -setup
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers /n? y
Select a compiler:
Lcc C version 2.4 in D:\APPLICATION\MATLAB\sys\lcc
Microsoft Visual C/C++ version 7.1 in D:\Application\vs2003
None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C/C++ 7.1
Location: D:\Application\vs2003
Are these correct?(/n): y
Try to update options file: C:\Documents and Settings\gaga\Application Data\MathWorks\MATLAB\R14\compopts.bat
From template: D:\APPLICATION\MATLAB\BIN\WIN32\mbuildopts\msvc71compp.bat
Done . . .
--> "D:\Application\matlab\bin\win32\mwregsvr D:\Application\matlab\bin\win32\mwcomutil.dll"
DllRegisterServer in D:\Application\matlab\bin\win32\mwcomutil.dll succeeded
--> "D:\Application\matlab\bin\win32\mwregsvr D:\Application\matlab\bin\win32\mwcommgr.dll"
DllRegisterServer in D:\Application\matlab\bin\win32\mwcommgr.dll succeeded
>> mcc -W cpplib:libcase1 -T link:lib case1
To get started, select MATLAB Help or Demos from the Help menu.
Warning: No matching builtin function available for D:\Application\matlab\toolbox\simulink\simulink\set_param.bi
然后在labview的调用函数库节点调用libcase1.dll文件
函数库节点库名或路径为:D:\Application\matlab\work\case1\libcase1.dll
函数名为:case1
函数原形为:voidcase1(int32_t x, int32_t y);
用一个数值输入控件作为x
一个数值输出控件作为y
labview左上放的运行按钮显示可运行,但运行后就会报错:
错误1097发生于 case1.vi中的调用库函数节点,可能原因
LabVIEW:调用库函数节点调用的外部节点中出现一个意外。意外可能引起LabVIEW内存损坏。在新位置保存工作并重启LabVIEW。
希望大家帮帮忙!!万分感谢!!! http://www.cpubbs.com/blog/?1288/viewspace-3138.html
仔细学习学习你
页:
[1]