Showing results for 
Search instead for 
Did you mean: 

Passing Cluster Containing Strings in C DLL as Struct

Go to solution

So like the attached example? This doesn't seem to work. Though I may be missing something.

0 Kudos
Message 11 of 16
Accepted by KeenanJohnson

Please be more specific than "doesn't work." Do you get an error, bad data, or some other problem?


The number of bytes to copy is 4x the array length, because each array element is 4 bytes. You are only allocating enough space for 1/4 of the array elements, and then only copying 1/4 of them.

Message 12 of 16

Ah yes that appears to have solved it. Thanks so much.


How did you figure out all of this? Trial and error? The documentation is pretty poor.

0 Kudos
Message 13 of 16

Mostly from reading lots of posts on this forum, especially the ones by RolfK; but also several years of C programming; a little trial and error; and reading the documentation, even though it's sparse.

0 Kudos
Message 14 of 16

Hello I have a similar problem : using Labview 2012 I have to pass a cluster parameter containing numeric values in C DLL developed with Visual C++ 20120 express (that configure serial channels on a Serial Board) as a Struct so defined :


struct ChannelInfoEx


ViInt16 interfaceType;

ViInt32 baudRate;

ViInt16 numBits;

ViInt16 stopBits;

ViInt16 parity;

ViUInt16 flowControl;



This parameter is passed to a VI as a AdaptToType with a format Handles by Value


All the fields of the struct (except interfacetype the first one) have a shifted values (stopbits has the value for parity numbits for stopbits and so on).

This problem is raised when I have deleted from the first filed of the struct (ViInt16 channelName) and I have tried to define all the fields as ViInt32 and the parameters are passed correctly.

Someone could help me and explain this strange behaviour ?? It's a Labview bug ??

There is a way to avoid to redefine all the fields as ViInt32 in the DLL ??

0 Kudos
Message 15 of 16

Hello Sergin,


This link is going to guide you to a pdf called: Using external code in LabVIEW, there is a complete chapter on how to use external Dlls in LabVIEW

Randy @Rscd27@
0 Kudos
Message 16 of 16