03-10-2015 05:04 PM
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.
03-10-2015 06:26 PM
03-11-2015 12:18 PM
I am using stdcall as the calling convention
03-11-2015 01:27 PM
03-11-2015 01:49 PM
I think the problem lies in my code for my AWG, I have attached a piece of the code that uses the dll library.
03-11-2015 02:18 PM
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...
03-11-2015 02:35 PM
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.
03-11-2015 03:29 PM
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.
03-11-2015 03:55 PM
03-11-2015 04:19 PM
@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.