468,253 Members | 1,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,253 developers. It's quick & easy.

byte[] as output parameter in managed C++

Hello,
I would like to know the managed C++ syntax of the following method
(defined in C#):

void temp(out byte[] byteArr).
I tried something like:
void temp([Out] byte byteArr __gc[])

But it didn't work.

Thanks,

Nov 17 '05 #1
3 1687
> Hello,
I would like to know the managed C++ syntax of the following method
(defined in C#):

void temp(out byte[] byteArr).
I tried something like:
void temp([Out] byte byteArr __gc[])


first, replace byte with Byte.

Next, the following should work:

using namespace System::Runtime::InteropServices;

void temp([Out] Byte (* byteArray)__gc[])

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
Thanks,
That did the trick for me.

How ever I'm not fimiliar with the syntax.
The syntax you've suggested:
void temp([Out] Byte (* byteArray)__gc[])

is not like:
void temp([Out] Byte __gc* byteArray __gc[])

What does (*byteArray) mean ? (looks like the syntax for function
pointers ...


Tomas Restrepo (MVP) wrote:
Hello,
I would like to know the managed C++ syntax of the following method
(defined in C#):

void temp(out byte[] byteArr).
I tried something like:
void temp([Out] byte byteArr __gc[])


first, replace byte with Byte.

Next, the following should work:

using namespace System::Runtime::InteropServices;

void temp([Out] Byte (* byteArray)__gc[])

--
Tomas Restrepo
to****@mvps.org


Nov 17 '05 #3
> That did the trick for me.

How ever I'm not fimiliar with the syntax.
The syntax you've suggested:
void temp([Out] Byte (* byteArray)__gc[])

is not like:
void temp([Out] Byte __gc* byteArray __gc[])

What does (*byteArray) mean ? (looks like the syntax for function
pointers ...


Nope, it is just to ensure the correct interpretation. Without the (), it
could be interpreted as an array of pointers to Byte, which is not what you
want. You need to be interpreted as a pointer to an array of Byte, which is
different :)

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Ray Z | last post: by
5 posts views Thread by Philippe Bertrand | last post: by
8 posts views Thread by intrepid_dw | last post: by
4 posts views Thread by EdInPhoenix | last post: by
1 post views Thread by Hifni Shahzard | last post: by
17 posts views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.