传递一个二维数组给LabVIEW DLL会导致一个通用的保护性错误
主要软件: LabVIEW Development Systems
主要软件版本: N/A
主要软件修正版本: N/A
次要软件: N/A
问题: 当我给一个LabVIEW DLL传递一个2维数组时,我的电脑会出现一个通用的保护性错误。发生这个错误的原因是什么?
解答: 当调用一个LabVIEW DLL时,首先需要声明处理程序变量并将其初始化为NULL,比如,在C中,代码如下所示:
main()
{
/* Labview data handler variable for the array */
TD1Hdl myArray = NULL;
.
.
.
/* Call to the Labview DLL function */
DLLFunctionalCall(&myArray);
.
.
.
}
如果不做该步初始化,你调用该DLL时,将会产生一个通用性保护错误。
下面附属的示例程序为在C中调用一个LabVIEW DLL,其参数包含一个2维数组。
注意:在其他应用中(比如Matlab®)当需要为LabVIEW DLL传递一个二维数组时,同样也必须保证在调用之前,初始化处理程序变量至NULL。
MATLAB®是被MathWorks, Inc.注册的商标。
相关链接:
附件: - Testme.vi - SharedLib.h - SharedLib.lib - Testing.c - SharedLib.dll
报告日期: 02/07/2001
最近更新: 10/12/2010
文档编号: 266GJJSV
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.