06-04-2005 12:44 PM
06-04-2005 02:27 PM
@BCK wrote:
I'm having a problem with a dll call I'm trying to use.
The dll has one input param: 'lpparm' which is a pointer to a structure which contains 3 arrays of bytes.
I have created a cluster with 3 clusters inside of it to pass the data to the dll, using "adapt to type" as the type - per an example I found in the forums.
The problem I am having is the dll runs, does what I expect and then labview crashes, with the message: "LabVIEW Development System has encountered a problem and needs to close. We are sorry for the inconvenience."
My hunch is it crashes because I don't know how to handle a struct output from the dll. For now I simply set the return type as numeric because I don't know what to do. The only options in LabVIEW for the return type are void, numeric, and string. How can a dll return a struct if it doesn't have "adapt to type" as a return type, as the inputs do?
Is there a way to handle this without having to change the dll (I don't have the source code)? Any help would be appreciated!
Regards,
Brad
LV 6.0.2
06-04-2005 03:48 PM
06-04-2005 04:17 PM
@BCK wrote:
Rolf,
Thank you for the reply - I appreciate your help. You are correct with your second example, I am sending 3 arrays of known length:
// Device Initialization parameters (ARFDeviceInit)
typedef struct ARFInitPrm_t
{
BYTE billLengthLongThr[8]; // Bill length long thresholds, mm (cassettes 1-8)
BYTE billLengthShortThr[8]; // Bill length short thresholds, mm (cassettes 1-8)
BYTE billThickness[8]; // Bill Thicknesses information (cassettes 1-8)
} ARFInitPrm_t;
I am still a little confused though. I passed the array into the dll as 1 dimension, 8 bit unsigned integer, and it still crashes - does the output of the dll write to that array, so I can connect an indicator direcly across from the input array?
The output of the dll is 'lpreply' that is a pointer to another structure of bytes and arrays of known length. Do I set the return type parameter = lpreply and what data type? Do I ingore the reply type completely?
Thanks again,
Brad Kettler
06-04-2005 05:33 PM
06-05-2005 08:10 AM
@BCK wrote:
Rolf,
I'm not quite getting it yet. I have attached a .vi that shows how I've implemented the dll and a screenshot of the dll manual - if you have time maybe you could take a look at it and let me know what I'm missing?
I initialized the output array to the size of the output I'm expecting, and wired that array indicator to the dll across from the input array, but it still crashes.
Thanks again,
Brad Kettler
06-05-2005 09:11 PM
06-06-2005 12:40 AM
@BCK wrote:
Rolf,
Thanks again for the help. Unfortunately, I believe the 'common' parameter actually is a pointer within the pointer, I didn't have any luck getting the dll to work.
I have been concurrently working on a direct serial interface as well, and was able to get the hardware working without the dll. Either way I learned a lot from your help - and hopefully others will too.
Regards,
Brad