LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

“Path” data type convert in CVI

I build my Labview project to DLL format file and then invoke in the CVI.
But i am troubled with Path format.
How can I convert Char/String to Path.
Thanks
Yuki
 
 
The function is as fellow.The data type of " *VideoFilePath" is Path???
 
#include "extcode.h"
#pragma pack(push)
#pragma pack(1)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
 LVBoolean status;
 long code;
 LStrHandle source;
 } TD1;

void __stdcall NI5431DownloadVideoFileToNI5431(char ResourceName[],
 double OutputLevelMVIRE, LVBoolean *DigiSync, TD1 *errorIn,
 Path *VideoFilePath, unsigned short *DetectedVideoFormat, TD1 *errorOut);
long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);
#ifdef __cplusplus
} // extern "C"
#endif
#pragma pack(pop)
 
0 Kudos
Message 1 of 2
(3,493 Views)
Hi Yuki_jin,

The easiest way to deal with LabVIEW specific data types in other languages is for your LabVIEW DLL to only expose C data types. Then in your LabVIEW DLL, you would convert that C data type over to a LabVIEW-specific type. For example, you could have your DLL accept a string and then in LabVIEW, you could use the String to Path VI

Now, if this alteration isn't possible, then you will need to use the LabVIEW memory manager functions to allocate the proper memory in your C code. In your Path case, you would need to so something like:

Path myPath = NULL;
char myString[512] = "C:\\Program Files\\National Instruments\\CVI85\\cvi.exe";
MgErr err;

err = FTextToPath(myString, strlen(myString), &myPath);
NI5431DownloadVideoFileToNI5431(......, &myPath, .....)

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 2
(3,390 Views)