LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When I close labview I get a Visual C++ runtime library error, how do I resolve this issue?

I am using Labview 2012 (64 bits) on a Windows 7 OS.

 

The error code is R6031 - Attempt to initalize the CRT more than once. This indicates a bug in your appilcation.

 

 

0 Kudos
Message 1 of 10
(4,066 Views)
What DLL calls are you using? That is where the problem will be.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 10
(4,053 Views)

I am using stdcall as the calling convention

0 Kudos
Message 3 of 10
(4,010 Views)
That's fine, but what calls are you making. For some DLLs that is OK and others it is not.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 10
(4,005 Views)

I think the problem lies in my code for my AWG, I have attached a piece of the code that uses the dll library.

0 Kudos
Message 5 of 10
(3,993 Views)

There's nothing obviously wrong that I can see. The one thing that I am not certain about is passing a LV cluster as a parameter directly to the DLL. Did you write this VI yourself, or did you get it from the vendor? Is this the only DLL call you are making in your code? Have you talked to the vendor about accessing the device from LabVIEW?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 10
(3,987 Views)

There are a couple of potential problems here:

- What is the definition of the Struct parameter? The boolean used in the struct may have a different representation than LabVIEW's boolean. Confusingly, on Windows, BOOLEAN is a byte, and BOOL is an int. (https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx) In LabVIEW, a boolean is a byte. If the representations don't match, you'll have problems.

- The "arg4" array parameter contains only a single value. How large should that array be? You need to pre-allocate the array to the correct size (using Initialize Array), or at least set the minimum array size parameter in the Call Library Function Node configuration.

- Check the numeric representation of the "arg4" parameter. You build an array of a 32-bit int, but pass it as a 16-bit array. LabVIEW will coerce to the type specified in the Call Library setup (as indicated by the coercion dot), but it would be a good idea to get the data type right instead.

0 Kudos
Message 7 of 10
(3,981 Views)

The code was written by the company and I have contacted the company to see if they know how to address this problem. Thank you all for your inputs and I'll let you know if a solution to this problem can be found.

0 Kudos
Message 8 of 10
(3,970 Views)
Nathan's comment reminded me of something. The representation of booleans in LabVIEW has changed over time -- not real recently -- but it has changed and there are a lot of vendors handing out really old code that they simply updated without retesting it.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 10
(3,966 Views)

@mikeporter wrote:
Nathan's comment reminded me of something. The representation of booleans in LabVIEW has changed over time -- not real recently -- but it has changed and there are a lot of vendors handing out really old code that they simply updated without retesting it.

That was a long time ago (I think the change was beween LabVIEW 6 and 7, so over 15 years ago) and it was just the representation of boolean arrays, not individual boolean values. Booleans within an array were at one time represented as individual bits, not bytes.

 

Maybe there's another change I don't know about, but that's the only one I'm aware of regarding the representation of booleans.

0 Kudos
Message 10 of 10
(3,956 Views)