LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert String to Char Pointer. Please help!

Hi,

I am writing a LabView application that communicates with the network via a dll. One of the dll function has an array of struct as the parameter. The struct members are a combination of char pointers and integers. I created an array of cluster with strings and integers.. which doesn't work because the dll is expecting char pointer and not LStrHandle.

How can I convert this LStrHandle to Char Pointer??? Please see the code for DLL and Call Library File below for data type details BELOW.

Please, please help.

Thanks,
Mim

DLL Function Format:
typedef struct {
TCHAR PatientName [26] ;
TCHAR PatientID [20] ;
TCHAR BedLabel [20];
TCHAR CareUnit [20];
TCHAR FileName [20];
TCHAR IPAddress [20];
TCHAR MulticastIP [20];
TCHAR DeviceType [20];
WV_OPERATING_MODE DeviceStatus ;
WV_CONNECT_ID ConnectID ; // 0 if not connected
} WV_BED_DESCRIPTION ;


typedef struct {
WV_BED_DESCRIPTION WvBeds[256] ;
} WV_BED_LIST ;

C File Created by CALL LIBRARY FUNCTION:
/* Typedefs */
typedef struct {
LStrHandle PatientName;
LStrHandle PatientID;
LStrHandle BedLabel;
LStrHandle CareUnit;
LStrHandle FileName;
LStrHandle IPAddress;
LStrHandle MulticastIP;
LStrHandle DeviceType;
int32 DeviceStatus;
int32 ConnectID;
} TD2;

typedef struct {
int32 dimSize;
TD2 elt[1];
} TD1;
typedef TD1 **TD1Hdl;

long WvListBeds(char ServerName[], char UserName[], char Password[],
TD1Hdl *BedList, long *NumberOfBeds);

long WvListBeds(char ServerName[], char UserName[], char Password[],
TD1Hdl *BedList, long *NumberOfBeds)
{

/* Insert Code Here */

}
0 Kudos
Message 1 of 3
(5,162 Views)
Hi Mim:

Are you using LabVIEW to call an existing DLL that you have in C? If so, you do not need to use the 'creat .c file' option on the Call Library Node. Instead you need to right click, go to configure, and select the DLL from a location. Then you need to select the parameters and you should be done.

If you are creating a new DLL from scratch, then we have a lot more options to do different things. Also, if indeed you are creating a new dll, have you considered writing the code in LabVIEW. LabVIEW has great TCP/IP and Datasocket functions that can allow you to communicate with your network.

I am attaching a link that might help in what you are doing. If you still have issues, could you maybe give us a better description of whether the dll already exists or if you are trying to write it and the prototypes for the functions?

Thanks,

JJ

Here is the example that I think will clarify things for you:

Using Structures in a DLL with Clusters in LabVIEW:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3DD8F56A4E034080020E74861&p_node=DZ52048
0 Kudos
Message 2 of 3
(5,139 Views)
Hi JJ,
Thanks for your post and help.

I got a solution for this problem from another post - LabView 6.1 crashes when function in dll is called using call library function and the problem is resolved.

Many Thanks for your time and help.

Regards,
Mim
0 Kudos
Message 3 of 3
(5,124 Views)