LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getting a string from a DLL thru a pointer

Hello,
 
I have a DLL that I need to call in order to translate a numeric identifier into a string.
The DLL function has the following prototype:
 
extern "C" __declspec(ddlexport) wchar_t* GetNumericString(int nId);
 
The difficult thing is that the DLL returns a wchar string pointer.
How can I get to the actual string value?
Also, I assume I have to free the string memory since I do not know how the DLL can otherwise know that I'm done using the string?
 
Note: I already created a LV function that can translate a U16 array into a string LabVIEW string.
 
Any idea on how I can get to the actual string value of this DLL in LabVIEW?
Thanks for the help!
 
0 Kudos
Message 1 of 3
(3,092 Views)

I worked around the problem by creating a DLL that handles the string pointer and returns me the string information to LabVIEW. 

I'm still interested if anybody can give a hint how I can do this directly in LabVIEW. (without the need of my extra DLL)

0 Kudos
Message 2 of 3
(3,074 Views)

Hi Noxus, 

Since Labview doesn't work with pointers, you are not able to get the string out of a pointer without another DLL. So what you are doing is the best option.

Regards,
Bas van Dijke
AE, The Netherlands

Message 3 of 3
(3,026 Views)