LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clusters in DLL header files

I am using LabView to create DLLs to call from LabWindows. When using clusters as input/output parameters, the C header files produced have unhelpful structure names given to each cluster such as TD1, TD2, TD3 etc. If you change the order in which your parameters are passed, or want to use the same structure to use in a different VI, the names differ.

Is there a way of getting the structure names the same as the cluster names?
0 Kudos
Message 1 of 4
(2,893 Views)


@Clare wrote:
I am using LabView to create DLLs to call from LabWindows. When using clusters as input/output parameters, the C header files produced have unhelpful structure names given to each cluster such as TD1, TD2, TD3 etc. If you change the order in which your parameters are passed, or want to use the same structure to use in a different VI, the names differ.

Is there a way of getting the structure names the same as the cluster names?




No! I usually only use the generated header file as a template creating my own types. Changing element order and such after you have created a DLL for them is in general a bad idea as it breaks binary compatibility between different versions of your DLL. This is likely to crash sooner or later when you happen to accidentially use a VI expecting a newer or older interface than the DLL which is loaded into memory or you happen to pick up an old DLL version by accident.

Rolf Kalbermater
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 4
(2,874 Views)

Hello!

When you (Rolf) writes that you only use the generated h-file as a template, do you mean that you can do your own h-file with other names of the typ-definitions? But with the same structure ofcourse.

We have a problem because we have 4 different "modules" which we convert to 4 DLLs. When C++ compiles this h-files it ofcourse says that it finds typedefinitions with the same name. I have been told that we cant change the name of the typedefinitions. How to do?

/TJ

0 Kudos
Message 3 of 4
(2,798 Views)


@Thomas Json wrote:

Hello!

When you (Rolf) writes that you only use the generated h-file as a template, do you mean that you can do your own h-file with other names of the typ-definitions? But with the same structure ofcourse.

We have a problem because we have 4 different "modules" which we convert to 4 DLLs. When C++ compiles this h-files it ofcourse says that it finds typedefinitions with the same name. I have been told that we cant change the name of the typedefinitions. How to do?

/TJ


Of course! Changing the names of variables and cluster elements in the C source code (or header) has absolutely no influence on the generated code as long as it is done consistently. Changing the datatype is a completely different issue and will evidently lead to crashes. The only naming you have to watch out are the function names (and albeit rarely used variable names) you would export from your library. They need to stay consistent of course as otherwise you get troubles at link time.

However in your case I would consider combining the four header files into one common header file with common type definitions and four separate header files containing the specific definitions and then adding an #include "<common>.h" to the top of each specific header file.
The only drawback of this is that if you ever modify one or more interfaces of your libraries you will have to go back to your self created header files and incorporate those modifications manually. But I think that is always better than having to work with the sometimes rather meaningless namings of the variables in the LabVIEW generated headers.

Rolf Kalbermatter

Message Edited by rolfk on 12-21-2005 10:29 AM

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