rk1960in Posted August 5, 2011 Report Share Posted August 5, 2011 unable to pass complex data type to LabVIEW. Attach is the VI - on front panel I have the data structure displaying the structure in Borland C++. When this VI is run it returns LabVIEW memory corrupt. Please advice if there are suggestions for workaround to get this data to display and use in LabVIEW. Thanks. testUDPVI2.zip Quote Link to comment
BigAngryHillMan Posted August 5, 2011 Report Share Posted August 5, 2011 I suspect that the number of bytes you are passing in to the Flatten to String is incorrect, Try writing your code so that you start with a netls3xmaintstatusstruct cluster convert that using Flatten To String and then compare that to the string in your example that you are passing into the Unflatten From String. You might find it better to create a wrapper function using variants. Quote Link to comment
rk1960in Posted August 6, 2011 Author Report Share Posted August 6, 2011 I suspect that the number of bytes you are passing in to the Flatten to String is incorrect, Try writing your code so that you start with a netls3xmaintstatusstruct cluster convert that using Flatten To String and then compare that to the string in your example that you are passing into the Unflatten From String. You might find it better to create a wrapper function using variants. Hello, The code on the other end is written in Borland C++, I am not sure how to do Flatten to String in C++? Also could you please elaborate on the last statement "You might find it better to create a wrapper function using variants". I am aware of variant in LV that takes any data type but again not sure on C++ and variants. TIA. Quote Link to comment
BigAngryHillMan Posted August 6, 2011 Report Share Posted August 6, 2011 Trying to pass a complex structure from Borland C++ to Labview directly is problematic, not least because you need to be each data type matches in size and byte order but also that the word boundary in your structure matches that of the cluster that you are trying to pass the data to. All very hard to debug. IT would be easier to write a DLL to be called from Labview that that takes a variant for each component of the complex structure you are trying to deal with and then assemble that in the DLL into the structure that you need and then call your Borland DLL. This will allow more debug as you can see the state of the variables before that are build into the structure. Remember that while Labview variants will contain any Labwiew type C++ variants will only hold types native to that environment. Quote Link to comment
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.