07-23-2013 03:20 PM
So like the attached example? This doesn't seem to work. Though I may be missing something.
07-23-2013 03:25 PM
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.
07-23-2013 03:37 PM
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.
07-23-2013 03:44 PM
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.
06-23-2015 08:50 AM
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 ??
06-24-2015 08:28 AM - edited 06-24-2015 08:28 AM
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
http://www.ni.com/pdf/manuals/370109a.pdf