LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CIN crash load object code

Hello,
 
I have three instances of CINs running two different object codes.  Two have the same object code loaded.
 
I am having major problems getting my computer not to crash when I load the object code, then execute.   I have all sorts of different errors...
 
.. sometimes it crashes when I try to load the object code
.. sometimes it crashes when I hit start
.. sometimes it crashes when i try to set a break point
.. something the whole thing runs fine and I can start and stop my prog, but when I hit the save button for my. vi, it crashes
 
I using my C program to do 64 bit encryption and cannot implement it in Labview.  I am passing it 2 arrays that are 1D, which I suspect are the culprits here.
 
I initialize the array size in labview, then access array variables (8byte array) using statements like (*CK_array)->Numeric[0] where the argument for Numeric is 0-7.  The program can run OK when I have everything commented out of my C files.  I have even reiterated my dimensioning by using (*CK_array)->dimSize = 8;
 
My most common error is for "fpsane.cpp" line 392.  I have tried recreating my objects on my main panel to get rid of this problem but have had no luck. I've looked at the creating a CIN .pdf and it does not help.  I have reviewed the replace.c and replace.vi examples too.
 
If anyone can give me any tips I would greatly appreciate it.  I am ready to port this thing over to LabWindows.
 
Thanks,
Greg
0 Kudos
Message 1 of 5
(2,768 Views)
Hello Greg.
I do not see any obvious problem - so here are my questions:
(1) Which compiler do you use?
(2) Have you tried to write exactly one array element (not any further) in your CIN? Does is then still behave like it is when you comment out everything?
(3) Have you tried to put further lines of your code into comments to find the problem in the code?

Regards, Guenter
0 Kudos
Message 2 of 5
(2,758 Views)
Hello,
 
I am using Visual Studio .NET 2003.
When I comment everything out, it runs OK.
I have tried writing to a single element of the array, and I still have this problem. 
 
I went ahead and changed my program to pass in only 32bit unsigned integers, and convert them to an array within the C program, then when the calculations are completed, the array is converted back to a 32bit uint.  This seems to be working.

I am not sure why my arrays however, cannot be written to.
 
Greg
0 Kudos
Message 3 of 5
(2,746 Views)
Greg,

What version of LV are you using?  When LabVIEW crashes, does it provide an error log the next time you open it? Is there any error window or message when the program crashes initially?  Is it possible to post a very simple VI and code that reproduces the behavior?
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 4 of 5
(2,733 Views)
Hi Greg,

I presume you're starting from the skeleton .c file you got from right-clicking on the CIN terminal? If so, could you share the function prototype and data types it defines?

Having a bit of experience with this myself, the most common problem with processing LabVIEW arrays in CINs / DLLs is memory corruption.

One reason for that happening, aside from losing track of how many times to dereference everything ( Smiley Wink ), is byte alignment.

In the 64-bit integer case, you probably have something like this:

typedef struct
{
    int32 dimSize;
    int64 data[1]
} MyData, *MyDataPtr,  **MyDataHdl;

When you change the type to int32, the alignment problems magically 'go away' because all the elements in the struct are the same size and no padding bytes are inserted. When the data is an int64, you have to make sure to compile w/ 1-byte alignment.

How are you building the CIN?

intvsteve
LabVIEW R&D
0 Kudos
Message 5 of 5
(2,732 Views)