noplo Posted August 29, 2012 Report Posted August 29, 2012 Hello all, I have the following problem. I'm using an external DLL in LabVIEW and one of the functions require a structure as an input parameter. Here's the structure: struct Pippo { DWORD ipAddress; DWORD centerFrequency; Pluto* array }; struct Pluto { DWORD size DWORD address } The function prototype is the following: myfunction( Pippo input ) I've used the Import Library Wizard from LabVIEW and it extract every field from the structures. So what I get as the function inputs is: ipAddress,centerFrequency,size,address. So basically the array is not treated and I get the 1097 error: LabVIEW: An exception occurred within the external code called by a Call Library Function Node. The exception might have corrupted the LabVIEW memory. Save any work to a new location and restart LabVIEW. I've read other threads from this forum and I tried to create the Pluto array of clusters but still the same error. How can I run the function correctly with these parameters? Thanks, Quote
asbo Posted August 29, 2012 Report Posted August 29, 2012 How do you know how many elements are in the array of Pluto structs? The two attached CLNs will help you operate with points. The second is useful for arrays of known length. Both are examples of operating on 4-byte signed integers. These look like snippets, but they are not. They were sourced from this article: Dereferencing Pointers from C/C++ DLLs in LabVIEW. Quote
Rolf Kalbermatter Posted August 29, 2012 Report Posted August 29, 2012 How do you know how many elements are in the array of Pluto structs? The two attached CLNs will help you operate with points. The second is useful for arrays of known length. Both are examples of operating on 4-byte signed integers. These look like snippets, but they are not. They were sourced from this article: Dereferencing Pointers from C/C++ DLLs in LabVIEW. Extra complication: The function may expect the array to be allocated by the caller too. If that is the case can only tell the documentation to that function. C is simply not detailed enough to describe the finer semantics of parameter passing. 1 Quote
noplo Posted August 29, 2012 Author Report Posted August 29, 2012 Thanks guys for the answers. I'm sorry I forgot an information. In the Pippo structure there's an extra field that tells me the dimension of Pluto. struct Pippo { DWORD ipAddress; DWORD centerFrequency; BYTE PlutoArraySize Pluto* array } So I know how many elements are in the Pluto array. I'm going to try what you suggested and let you know. Thanks, Quote
asbo Posted August 29, 2012 Report Posted August 29, 2012 When using CLNs and *especially* when directly manipulating memory, save your VI before every time you run it! I can't count the time of times I've crashed LabVIEW mucking around with CLNs. Quote
noplo Posted September 6, 2012 Author Report Posted September 6, 2012 Hello guys, I wasnt' able to manage the DLL as suggested so I did a wrapper DLL in CVI in order to be called from LabVIEW and now it looks ok. Thanks, Andrea Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.