'Out' keyword in methods parameter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following DLL function prototype:
RW_DLL_API int ReadBDll(DWORD Address,DWORD NumOfUnits, BYTE * val);

I use this function from C# application as following:

[DllImport("RW_DLL.dll")]
extern static int ReadBDll(UInt32 Add, UInt32 NumOfUnits, out byte [] Block);

then I call this function :
byte [] arrayB = new byte[5];
int i = ReadBDll(0x2e, 5,out arrayB );
after execution the function I got 'arrayB' = <undefined value> .. WHY?

how can I do that sent array of bytes to function then got the arrayB values????
 
I have the following DLL function prototype:
RW_DLL_API int ReadBDll(DWORD Address,DWORD NumOfUnits, BYTE * val);

I use this function from C# application as following:

[DllImport("RW_DLL.dll")]
extern static int ReadBDll(UInt32 Add, UInt32 NumOfUnits, out byte []
Block);

Are you sure that it should be the "out" keyword there?
From the code that follows, it seems like you need to use the "ref" keyword
instead?
then I call this function :
byte [] arrayB = new byte[5];
int i = ReadBDll(0x2e, 5,out arrayB );
after execution the function I got 'arrayB' = <undefined value> .. WHY?

To give a correct answer to your question, we would really need to know what
the function is supposed to do, and how...

// Bjorn A
 
Back
Top