新闻中心

EEPW首页 > 测试测量 > 设计应用 > LabVIEW string/array Type

LabVIEW string/array Type

作者:时间:2017-01-06来源:网络收藏
LabVIEW CLN调用dll时,接口只能是c99的类型,不可以使用c++的string类型。
LabVIEW有其定义的string类型: LStrHandle。
————————————————————————————————————————————————————--------------------------------------------------------------------------------------------
C++的code如下:
#include"extcode.h"
// "extcode.h"的路径是在C:Program FilesNational InstrumentsLabVIEW 2009cintools 里面。如果想用到extcode里面的一些函数,需要链接库labview.lib
typedefstruct{
int32 len;
LStrHandle elm[1];
} **LStrArrHd1;
extern"C"_declspec(dllexport)voidstrArrayTest(LStrArrHd1 strArray);
voidstrArrayTest(LStrArrHd1 strArray)
{
intarraySize = (*strArray)->len;
LStrHandle h = (*strArray)->elm[0];
intcurStrSize = LStrLen(*h);
char*curStr = (char*)LStrBuf(*h);
intlen = strlen(curStr);
}
dll的parameter属性如下:

——————————————————————————————————————————————
Labview具体的string、array类型如下:



例子如下:




关键词: LabVIEWstringarrayTyp

评论


技术专区

关闭