From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

About calling dll

Solved!
Go to solution

How to define the tchar type in labview123.JPG

0 Kudos
Message 1 of 15
(3,546 Views)

It's not a TCHAR. TCHAR is the Win32 API name for a character code point that could be either Unicode or ASCII depending on preprocessor magic. Because your API specifically specifies that it is Unicode and Visual Basic Strings are Unicode anyways by default it is an array of WCHAR's.

 

This is basically an array of uInt16 integers. And you will need in addition to use some ASCII to Unicode conversion library to convert your LabVIEW strings to Unicode strings in order to pass them to this function.

The function name you need to set in the Call Library Node configuration is most likely called lmcl_initial2 and not Initialize, which is only a Visual Basic alias to use in the Basic program.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 15
(3,489 Views)

23.JPGWhat I mean is how to define the parameters of the library function"strEzCadPath"type

 

thanks a lot !

0 Kudos
Message 3 of 15
(3,472 Views)

Array of 16 bit integers passed as C string pointer.

Rolf Kalbermatter
My Blog
Message 4 of 15
(3,433 Views)

I am sorry! I still did not understand, you can not say the details of the point.
such as:
Name: strEzCadPath
Types of:?
constant:?
type of data:?
Data Format:?
thank you very much!

0 Kudos
Message 5 of 15
(3,420 Views)

rolfk 已写:

Array of 16 bit integers passed as C string pointer.



I am sorry! I still did not understand, you can not say the details of the point.
such as:
Name: strEzCadPath
Types of:?
constant:?
type of data:?
Data Format:?
thank you very much!

0 Kudos
Message 6 of 15
(3,419 Views)

@NJ_yang wrote:

rolfk 已写:

Array of 16 bit integers passed as C string pointer.



I am sorry! I still did not understand, you can not say the details of the point.
such as:
Name: strEzCadPath
Types of:?
constant:?
type of data:?
Data Format:?
thank you very much!


Name: irrelevant for the functionality, only for documentation

Type: Array

Constant: checked if it is an input parameter to the DLL function, not checked if the DLL writes something into it for the caller to use, but if you leave this unchecked it is always safe just may prevent LabVIEW to do some extra optimizations

Data Type: (signed or unsigned) 16 bit integer

Dimensions: 1

Array format: Array Data Pointer

Minimum size: <None> if it is an input parameter to the function, otherwise the number of elements the array should provide for the function to write into, according to the documentation for the parameter for this function.

Rolf Kalbermatter
My Blog
Message 7 of 15
(3,392 Views)

Dear rolfk, thanks for your help to let me have a new direction.
I would also like to ask how 16-bit integer array can include (TCHAR * strEzCadPath, BOOLbTestMode, HWND hOwenWnd) type, is not to convert the input parameters into 16-bit integer array?
thanks a lot

0 Kudos
Message 8 of 15
(3,370 Views)

It doesn't include all those parameters, only the first!!

And you need to convert LabVIEW strings into Unicode strings in order to pass it to this parameter. LabVIEW strings are 8 bit Multibyte Code Sequences (ASCII for most western locales).

There are routines to do that, namely here! you can also download this with VIPM under the name ni_lib_unicode-2.0.0.4.vip or maybe a newer version.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 15
(3,356 Views)
Solution
Accepted by topic author NJ_yang

The other parameters are:

 

Name: bTestMode

Type: Numeric

Constant: checked

Data Type: (signed or unsigned) 32 bit integer

Pass: Value

 

Name: hOwenWnd

Type: Numeric

Constant: checked

Data Type: (signed or unsigned) pointer sized integer

Pass: Value

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 15
(3,353 Views)