LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

An imported Share Library (DLL) function expects INTEGER POINTER to the beginning of an array to be passed in

Are you able to call the DLL function successfully?

0 Kudos
Message 11 of 15
(594 Views)

sorry for not responding sooner. Yes, yesterday I was able to the load and retreive in the DLL that my software group created.   Your insight that the Importation Wizard does know that the pointer is to an array was eye opening. The other tidbid that you mention was that I needed to change the paramters to arrays which original i thought was a mistake but did not realize that LabView would internal resovle my misunderstanding I had. So i inialized an array then loaded a second array and retrieve the array without having to index through the second or third array.

 

I have a mixed data type array which I beoieve llabview should handle like a cluster. Do I perform a similar operate to pass the pointer by reference?

Einstein proved by taking time in thinking about a problem he proved there is no such thing as gravitational pull. Therefore, given enough time and thought a problem can be solved. If the problem is not solved then there has not been enough thought.
0 Kudos
Message 12 of 15
(590 Views)

jetfan67 wrote:

I have a mixed data type array which I beoieve llabview should handle like a cluster. Do I perform a similar operate to pass the pointer by reference?


Yes. If you have a struct that needs to be passed by pointer, you configure the parameter as "Adapt to Type" in the Call Library Function Node setup, and then pass a cluster that matches the struct.

 

The LabVIEW cluster must not contain any variable-length elements (strings or arrays). If the C struct contains a fixed-size array or string, replace it with a nested cluster of the correct number and type of elements. For example, if your C struct contains a 10-byte string, you would insert a cluster of 10 U8 values inside the larger cluster. There are many examples of this on this forum. Also be aware that LabVIEW packs clusters as tightly as possible, but on Windows struct elements are aligned naturally (unless specifically instructed otherwise at compile time using the pragma pack() directive), so you may need to add some padding elements to your cluster.

 

Some searching on this forum (I recommend using Google with "site:forums.ni.com" instead of the forum's built-in search) will turn up many threads on passing clusters or structs to DLLs from LabVIEW. RolfK's posts are particularly helpful.

0 Kudos
Message 13 of 15
(587 Views)

Is this document in any of the NI LabView manuals or is this all by word of mouth. 

 

Are you NI support?

Einstein proved by taking time in thinking about a problem he proved there is no such thing as gravitational pull. Therefore, given enough time and thought a problem can be solved. If the problem is not solved then there has not been enough thought.
0 Kudos
Message 14 of 15
(584 Views)

@jetfan67 wrote:

Is this document in any of the NI LabView manuals or is this all by word of mouth. 


The most relevant document from the LabVIEW help in this respect is "How LabVIEW Stores Data in Memory." The help for the Call Library Function Node is useful. There are documents floating around the NI site, for example "Clusters in LabVIEW Do Not Line Up With Structures in Visual C++" but you have to run across them through searches. Passing data between LabVIEW and a DLL requires some understanding of C, and pointers, for anything but the simplest data types (and there are plenty of ways to learn C; it shouldn't be part of the LabVIEW documentation).


jetfan67 wrote:

Are you NI support?


No; like most of the participants on this forum, I'm a LabVIEW fan and not employed by NI. NI employees are recognizable because their usernames and color badges (above the avatar) are blue, rather than gray and orange for other users.

0 Kudos
Message 15 of 15
(581 Views)