LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing a structure using DLL

Hi,
 
I am new to the concept of CIN and Call Function Node.
 
I have a DLL which is built using Visual Studio. Programming is done in C++.
 
The DLL has a function called"ASIO Error ASIO ClockSources(ASIO Clocksources * clocks,Long*numSources)
 
ASIO Clock sources is a structure having these many information
 
Struct ASIO ClockSource{
Long index;
Long associated channel;
long associated group;
ASIOBOOL is current source;
char  name[32];
}
 
I can see the function called Get ClockSources function when I access the DLL, but how to proceed using this .... I dunno.
 
Pls help me in this matter.
 
Lil urgent.
0 Kudos
Message 1 of 5
(3,005 Views)
Hi cancancan…,
create a cluster with your data types. You can connect the cluster to the "Call Library Function Node". Select "adapt to type" as type.
 
Hope it helps.
Mike
0 Kudos
Message 2 of 5
(2,994 Views)
Actually, the names of the arguments leads me to believe that it's expecting an array of structures, rather than a single structure. At the very least it wants a pointer to a structure. However, the syntax presented seems to be a mangling of proper C syntax and someone's idea of making it sound more like English. Do you know how this function is supposed to be used? Is it intended to operate on an array?

EDIT: Also, open the Example Finder (Help -> Find Examples) and search for "DLL". Open the example called "Call DLL". It will present many examples of how to pass various parameters to DLLs.


Message Edited by smercurio_fc on 06-11-2008 09:21 AM
Message 3 of 5
(2,985 Views)
This is already the built code.The structure in the function prototype is addressed by a pointer.
Structure here is a output parameter
Actual functionality is, the function gets the data from the hardware device and outputs in the form of structure.
I cant modify the source code provided.
For ex ASIOError ASIOGetChannels(long*numInputChannels,long*numOutputChannels);
This I can easily achieve from the Call function node. As I know there is parameter which is of long type and pointer to access it.
 
Similarly the function
The DLL has a function called"ASIO Error ASIO ClockSources(ASIO Clocksources * clocks,Long*numSources)
ASIO Clocksources is a structure.
Now since there is no option for cluster or structure selection in Call library function node... I dunno how to proceed.
0 Kudos
Message 4 of 5
(2,964 Views)
As mentioned previously, to pass a structure you create a cluster and use "Adapt to Type". Did you look at the "Call DLL" example?

However, the names of the arguments leads me to believe you're dealing with arrays of structures: ASIO Error ASIO ClockSources(ASIO Clocksources * clocks,Long*numSources). This pretty much tells me it wants an array of structures, not a single structure. You have the library and you have the documentation. Is this what it wants?
0 Kudos
Message 5 of 5
(2,944 Views)