C
Code Assassin
Guest
I have a C++ DLL that I created (unmanaged) and a C# test application used to test the functions. I am trying to take an array of bytes (byte[] arr = new byte[512]) in C# and call my C++ DLL. Inside the C++ DLL it will modify the values in the array that I passed to it from C#. When the routine returns back to C# I want to modifications I made in C++ to be seen in the C# program.
I was trying to use the Add Method Wizard in VS2012 to add a Method in the C++ DLL which would take the array, however there are only a set number of choices in which to use (for example CHAR, CHAR*, BYTE, BYTE*, LONG, LONG*, etc.). Looking through the forums I have found many different examples for doing something like this, but not exactly. I am looking for some easy way to do this
My question is, how can I pass the array from C# AND be able to modify it in my C++ DLL and have the modifications stick and not give me a memory protection error.
My C# call is as simple as Test(ref Ar)
My C++ routine I last tried was Test(BYTE &ar)
Im just not sure how I should approach this and am open to suggestions.
Continue reading...
I was trying to use the Add Method Wizard in VS2012 to add a Method in the C++ DLL which would take the array, however there are only a set number of choices in which to use (for example CHAR, CHAR*, BYTE, BYTE*, LONG, LONG*, etc.). Looking through the forums I have found many different examples for doing something like this, but not exactly. I am looking for some easy way to do this
My question is, how can I pass the array from C# AND be able to modify it in my C++ DLL and have the modifications stick and not give me a memory protection error.
My C# call is as simple as Test(ref Ar)
My C++ routine I last tried was Test(BYTE &ar)
Im just not sure how I should approach this and am open to suggestions.
Continue reading...