From: mchp1 on
I thought I set that...   Thank you.
From: mchp1 on
Ok, I think that the problem may be arising because I am not initializing the buffer that I am feeding the write or the buffer that I am reading from the read function .  How can I do this?  The Write function is expecting an array of type BYTE[64] and the Read function should return an array of type BYTE[64]. extern "C" __declspec(dllexport)DWORD MPUSBRead(HANDLE handle,             
// Input                PVOID pData,                //
Output                DWORD dwLen,                //
Input                PDWORD pLength,             //
Output                DWORD dwMilliseconds);      // Inputextern "C"
__declspec(dllexport)DWORD MPUSBWrite(HANDLE handle,             //
Input                 PVOID pData,               //
Input                 DWORD dwLen,               //
Input                 PDWORD pLength,            //
Output&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD dwMilliseconds);&nbsp;&nbsp;&nbsp;&nbsp; // Input<img src="file:///C:/DOCUME%7E1/GBRACA%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="">


sh.jpg:
http://forums.ni.com/attachments/ni/170/348808/1/sh.jpg
From: smercurio_fc on
mchp1 wrote:Ok, I think that the problem may be arising because I am not initializing the buffer that I am feeding the write or the buffer that I am reading from the read function .&nbsp; How can I do this?&nbsp; The Write function is expecting an array of type BYTE[64] and the Read function should return an array of type BYTE[64].Did you read my replies? That's precisely what I said in reply #5. Also, it makes no sense that it requires a fixed byte array of 64 elements. If it did, then the read would not require a separate input of how many elements are in the array. Same goes for the write. In your example C program you were pre-allocating an array of 64 bytes, but tellng the functions that the array length was 4 for the receive and 2 for the send. Made no sense to me, but whatever.To have the read function read a maximum of 64 bytes then you would do something like this:<img src="http://forums.ni.com/attachments/ni/170/348818/1/MPUSBRead_BD.png"> This allocates an array of 64 bytes and tells the function that you are providing an array of 64 bytes (not 4). The function will return how many bytes were read with its output parameters. Note that the output array will still be 64 bytes. You can use Split Array if you wish to chop off the extra zeros.Message Edited by smercurio_fc on 08-12-2008 04:24 PM


MPUSBRead_BD.png:
http://forums.ni.com/attachments/ni/170/348818/1/MPUSBRead_BD.png
From: mchp1 on
Thank you.&nbsp; I found the problem.&nbsp; I was calling the dll through the &quot;Call Library Function&quot; as if it were using the stdcall convention instead of the c convention.
From: smercurio_fc on
My comments regarding the pre-allocation requirement are still valid since you have to do that.
First  |  Prev  | 
Pages: 1 2 3
Prev: 0x%08lx error
Next: Catch logout or shutdown event