LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView 7.0 Crashes when initializing an array

Hi there,
When i'm trying to initialize an array (like on the left side in the attached picture) labview 7.0 crashes.
The errorcode is:
AppName: labview.exe AppVer: 7.0.0.4000 ModName: labview.exe
ModVer: 7.0.0.4000 Offset: 00801e0e
To verify that I tried a circuit like on the right side of the picture - no error occurs...
How can I solve this bug?

Greets
0 Kudos
Message 1 of 6
(3,019 Views)
I checked on LV 7.1 and could not reproduce the problem.

From what you show, I would rather try to look if there isn't a problem in your dll for the value you put in.

NB : To make a 1D Array, you can use the vi "build array" with a single value connected to it. So you don't need to use the "initialize 1D array".

Doc-Doc
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 2 of 6
(3,019 Views)
I use now the vi "build array" and now it works fine.
And use less place....
THX very much for your help!

Greets
0 Kudos
Message 3 of 6
(3,019 Views)
LabViewFreak wrote:
> Hi there,
> When i'm trying to initialize an array (like on the left side in the
> attached picture) labview 7.0 crashes.
> The errorcode is:
> AppName: labview.exe AppVer: 7.0.0.4000 ModName: labview.exe
> ModVer: 7.0.0.4000 Offset: 00801e0e
> To verify that I tried a circuit like on the right side of the picture
> - no error occurs...
> How can I solve this bug?

Does this happen during the first call already? Do you have any Call
Library Nodes which are called previously? (I think yes as you get a
handle somewhere).

Initialize Array somply never crashes in LabVIEW on its own. However if
you call a DLL function which has a bug or with wrongly setup parameters
that DLL function can overwrite memory which belongs to LabVIEW and
cause L
abVIEW to crash on some other seemengly unrelated function,
somethimes minutes or longer after the actual corruption has happened.

Replacing Intitialize Array with Build Array as you indicate later on
will not solve that problem but only hide it and cause other problems
sooner or later. You need to find the DLL call which causes the memory
corruption.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 6
(3,019 Views)
And how can I find the corrupted DLL call?
Are there any tools that will help me to find something like that?
It's my first programm using DLL's... 🙂

THX & Greets LabViewFreak
0 Kudos
Message 5 of 6
(3,019 Views)
LabViewFreak wrote:

> And how can I find the corrupted DLL call?
> Are there any tools that will help me to find something like that?
> It's my first programm using DLL's... 🙂

Other than carefully examining all DLL calls with the according function
documentation there is only trial and error left. Basically make sure
you define function parameters which need to be passed by reference to
be "passed as pointer" (in the C header they usually are declared
something like {type} *{name}.

Also the caller (here LabVIEW) needs to allocate any memory buffer the
DLL might need to fill in data into. LabVIEW can't do this automatically
as it has not enough information to do the right thing (TM). So you need
to give it a hand.

If you need to pass arr
ays to a function, allocate them properly in the
LabVIEW diagram. They need to contain at least the number of elements
the DLL function is documented to require and then passed to the left
terminal of the Call Library Node for that parameter.

For strings they need to be allocated as well with large enough size on
the LabVIEW diagram and should be one byte longer than the longest
string the DLL might ever want to put in that string buffer. It's
easiest to use "Intialize Array" here also with an unsigned 8bit integer
constant and the correct number of elements and then pass that array
through the "Byte Array To String" function before wiring it to the left
terminal of the Call Library Node.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(3,019 Views)