LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using call DLL

Hi,

I am using a third party software using call dll function.

I am having a problem with defining one of the functions in the dll.

I am not sure how to configure that function.

I am including the dll, the c file of the function and also the header of the function.

Can anyone help me in building the VI using call dll function.

Thanks a lot.
Download All
0 Kudos
Message 1 of 2
(2,729 Views)
Ajit wrote:
> Hi,
>
> I am using a third party software using call dll function.
>
> I am having a problem with defining one of the functions in the dll.
>
> I am not sure how to configure that function.
>
> I am including the dll, the c file of the function and also the header
> of the function.
>
> Can anyone help me in building the VI using call dll function.

Do you understand the C code?

Without going actually in there and just from the header file I would
say you create a VI with a Call Library Node. The open the configuration
dialog of that Node and fill in:

Library Name: lcmaster.dll
Function Name: LCOM_MasterGetLine
return value: not sure
1. param: ID, numeric, I32, by value
2. value: Buffer, array of U8, 1 dimension, pass as pointer
3. param:
Length, numeric, I32, by value

Now create an array of U8 on the diagram, with the Initialize Array
function and some size as required by the function and wire that same
length to the third parameter. Wire the array to the second and whatever
your ID is to the first. Parse the right side of the second parameter in
whatever way you need to retrieve the data from it.

A few difficulties exist.

1) your functions uses globals and seems not protected, so let it run in
the UI thread as otherwise you may crash.

2) Your header does not show what EXPORT means. This could mean stdcall
or cdecl. You will have to make sure you configure the CLN to use the
correct Calling Convention as otherwise it will crash.

3) Your header does not show the type of LCOM_RES, so I'm not sure what
to do but I would assume it is a Numeric and either 8, 16, or 32 bits long.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 2
(2,729 Views)