06-09-2011 12:16 PM
Hello,
I'm trying to pass an array to a dll in a sub VI and it wont work, our dll func keeps returning error 998. I believe this is the Windows error ERROR_NOACCESS
Ive attached the vi.
I'm Using Array Data pointer 1D array of unsigned 8 bit bytes
The dll func returns either a 4 6 or 12 byte array depending on which board its talking too.
A previous contractor that wrote this vi claims the 4 byte version was working but I cant get either to work.
Several customers have tried to do this and all have faled.
At this time we cant change our C dll.
I'm using LabView 7, I just got approval to buy LabView 2010, I'm not sure if that will help this issue though.
using WinXP Pro
Any suggestions would be greatly appreciated.
Is there a way to pass a fixed length array in as a pointer? Cant seem to figure thast out. Cluster?
I'll keep working on it and searching for clues here in the forum.
Cheers,
Richard
Solved! Go to Solution.
06-09-2011 06:14 PM
OK still working on this one.
It looks like we report this error in our driver when someone passes a NULL pointer or a pointer to an array that is too short and we cant do a proper copy of the buffer or a write to the buffer array. so what exectrly gets passed down from LabView??? from my reading so far it looks lik its like "unsighned char Buffer[]" which should work fine, also we dont resize the array at any time just basically write 4, 6 or 12 (8 bit) bytes to it. Any suggestions? writing a CIN doesnt seem like a practical solution. Ive checked and tested all the CLFN configure possibilities. Labview reports #0 for the array going into the CLFN or comming out? Is Labview sending a NULL pointer to our dll???
06-10-2011 12:47 PM
Maria from tech Support is a Goddess!!!!!!!!!!!!!!!!!!
The key was to have an array input as I was doing, but then set it to ones "1" non zero value. I had created a 6 wide array but left the values at the default zeros which was in effect uninitialized or NULL buffer[0] = 0 hence buffer[] or *buffer is NULL pointer which blew chunks in our driver LOL . whats funny is in Labview even if i set the values back to 0's its doesnt revert back to null it still thinks its a 6 element array. Have to look into how to init this thing to 0 properly but 1's are fine to ensure for customers its not null. thanks all for looking.
06-10-2011 01:05 PM
To ReInit your array from the front panel, right click on the control then Data Operations->ReInitialize to Default or Data Operations->Empty Array.
If you're doing this from a block diagram, you should just be able to reinit by using an array constant.
06-10-2011 01:22 PM
Yeh I attached the fixed version for comparison.
But your right if I set the values to 12 zeros then right click data operastiom "make current value default" then reinitialize to defaults then it stay as a 12 element array and works. as indicated in run mode with highlight execution on, it shows up as a #12 instead of #0
Now if I make it a constant instead of a control or indicator it works the only difference is now if you look at the block diagram the 0-11 elements are bold and 0 instead of grayed out and zero which is uninitialized that the key. So if i leave it like that and just make a big note to users in the comments and on the sub vi fp too to leave this alone or you will cause the bug again I should be fine also leave it at index 11 so they can see its initialized to zeros. Thanks for the reply. Interesting stuff.