11-07-2007 10:45 AM
11-07-2007 03:35 PM
11-08-2007 03:16 PM
11-09-2007 11:13 AM
01-15-2008 03:55 AM
It's not the initialization that is important, but the allocation. An array has a certain lenght in memory that is reserved by an allocation. This length can be 0 bytes. When you pass in an empty array (0 bytes) that is fully valid but if the DLL then tries to write into that array (your initialisation or later some data) you write into memory that can and most probably has been allocated by LabVIEW for other things. Et voila you corrupt LabVIEW memory and sooner or later crash.
@l1k wrote:
I finally got things working. You need to initialize arrays going into the DLL in LabView (even if they are also initialized in the DLL). Otherwise, everything was working. There was a document I missed that helped a lot here:
http://digital.ni.com/public.nsf/allkb/58596F5D41CE8EFB862562AF0074E04C?OpenDocument
Thanks!
03-23-2011 03:13 AM - edited 03-23-2011 03:20 AM
Hi guys (and gals if any)
I have the same problem (error 1097) when trying to access a function of my DLL, that passes an array. I am sure that everything is alright, as in C++ syntax, header and labview. I think my problem is about memory allocation. I initialize the output array with 0's.
What is most peculiar is that just once i got some values in my output array. But that happened only once. 😕
What advices you have, if you had this same problem ?
Thanks.
PS: LabVIEW 2009. Visual C++ 2010.
03-23-2011 04:17 AM
You say that everything is right in terms of allocation, C Syntax, and Call Library Node configuration therefore assume that posting your actual VIs and code won't help. But I have to inform you that the information you give does certainly point to the fact that there is something wrong with one or more of these things.
Simply put: LabVIEW hasn't caused errors or crashed on me in quite a number of years now when using the Call Library Node, UNLESS I made an error in one of these mentioned things. So eventhough you believe you did everything right I'm 99.9% sure there still is a problem and you need to investigate that.
As to how I debug these things, it all depends. In most cases the DLL is from me so I have the source code and can do source level debugging. If the DLL is not yours you will have to carefully check everything once more, or even better yet put it out to someone knowledgeable. Another pair of eyes always helps, and can discover things you have overlooked over and over again.
03-23-2011 04:17 AM - edited 03-23-2011 04:18 AM
deleted duplicate post
03-23-2011 05:49 AM
Hi Rolf,
Thanks for answering.
Well, obviosuly there is an error in my implementation, but I cannot tell where. Everything I did seemed pretty straight forward. I thought there might be a "well-known" issue of the matter. Anyway this is my first experience in DLLs with LabVIEW.
I have attached my files if you have time to take a look over them.
Thanks.
03-23-2011 06:06 AM