how to pass a byte array by reference

S

sreelakshmi.rajula

Hi ,
I am new to Managed c++ and C# .
I've to use unmanaged code in C# . For that I've written a managed
wrapper. I am passing a byte array to a function and updating that byte
array. And I've to use that in my C# code.
And the link
http://groups.google.co.in/group/mi...4+++managed+c++&rnum=3&hl=en#6a697b4b060b8f93
says that
"you dont need to declare it as a reference, since in Managed C++ you
pass
everything by reference by default."

So I've tried like foo(Byte byteBuffer __gc[]) in my MC++ code.

But when I get the value in my C# code it has not been updated.

Can any one know how to pass a byte array by reference ..

Thanks in advance....
Regards,
RSL.
 
M

Mattias Sjögren

So I've tried like foo(Byte byteBuffer __gc[]) in my MC++ code.

That should work as long as you only want to change the elements of
the existing array. If you want to return a new array, you need to
pass it by reference.

But when I get the value in my C# code it has not been updated.

Can you post more of your code? Perhaps the problem is elsewhere.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top