LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Array argument too small

Solved!
Go to solution

Hi,

 

I'm updating some old code running on labview with labwindows dlls. I updated all the old 32bits dll to 64bits dll and now debugging.

 

While executing the labview exe (in debug mode with labwindows dll) I get a fatal run time error in labwindows during the call of one function of a dll : 

 

The call :

 

Spoiler
Trace("42 BYTES STRING");

 

The error :

 

Spoiler
FATAL-RUN-TIME ERROR : Array argument too small (42 bytes). Argument must contain at least 21474837 bytes.

 

The trace function is really simple and writes the char array to a file :

 

Spoiler

 

void __stdcall Trace(char message[BUFFER_SIZE])

{

     if (flag_trace) fprintf(file_trace, "%s", message);

}

 

 

The mos suprizing thing is that juste before the call to the trace function there is a call to another log function called JdB() and it is exactly the same definition, and I get no errors, so it's not a path, or a file permission thing, I really don't understand why the first call to JdB() works perfectly and the call to Trace() just after with the same architecture crashes...

 

It looks like the program doesnt even go inside the trace() function but crashes at the call.

 

I don't know why it is expecting 21474837bytes (2^31 -1) and especially why it works with the first function and not the second...

 

Thanks

 

 

 

0 Kudos
Message 1 of 6
(1,892 Views)

Any chance BUFFER_SIZE is undefined when used?  It sort of sounds like a negative integer value is being evaluated as a very large positive int.

0 Kudos
Message 2 of 6
(1,856 Views)
Solution
Accepted by topic author OctaveL

Solved: after some research it turned out that the problem came from the function name: trace(), I changed it and everything works normally.

 

There is indeed a trace() function (with a different prototype) in a LabWindows library but it was not included and there was no indication of a conflict...

 

So maybe a bug ?

0 Kudos
Message 3 of 6
(1,841 Views)

Maybe it's declared as _weak_, but I can't find it in the libs (where did you find it?). There is a Trace() in the Advanced Analysis Library for matrix stuff.

0 Kudos
Message 4 of 6
(1,824 Views)

Yes its the the Trace() function of Advanced Analysis Library.

 

Well I think, I don't see any other explanation but maybe there is...
Because when compiling the Trace() calls it offered to include this library when I removed the prototype and the definition of my own Trace() function so I deduced that but maybe it's hasty.

0 Kudos
Message 5 of 6
(1,821 Views)

It's probably a question of the default linking order. In some way it's indeed a bug as the linker should first search the local compiled project libraries for symbols before trying to link to standard libraries. On the other hand, it is probably not as simple and with the llvm backend it may be even out of control of LabWindows/CVI.

 

Did you include the Advanced Analysis Library in your project settings as included? Do you use any functions of that library? If not you would just need to make sure it is not selected as a project library. But trying to not conflict with symbol names of standard libraries is of course always the better solution.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(1,788 Views)