最近在研究用C生成.dll,在LV调用,但是在做到字符串数组中不知道为什么总是不成功,下面是在VC下的代码 麻烦版主帮看看,谢谢 // test.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include "extcode.h" #include "string.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } typedef struct { int dimSize; LStrHandle array; } TD1; typedef TD1 **TD1Hdl; extern"C"__declspec(dllexport) void LVArrayChar(TD1Hdl output); extern"C"__declspec(dllexport) void LVArrayChar(TD1Hdl output) { NumericArrayResize(uB,1L,(UHandle *)&(*(*output) ->array), 100); (*output) -> dimSize = 100; strcpy((char*)(*(*output) -> array) ->str,"abcd"); (*(*output) -> array) -> cnt = 100; } |