Groups | Blog | Home
all groups > visual c > march 2007 >

visual c : Best way to use unmanaged buffer as a Byte []? preferably w/o copying from native to managed memory



adebaene NO[at]SPAM club-internet.fr
3/27/2007 8:02:53 AM
[quoted text, click to view]

Use System::IO::UnmanagedMemoryStream.

[quoted text, click to view]

You shouldn't, as long as a profiler hasn't proved that there is
indeed a performance bottleneck (this is true, as well for native as
for managed code).

Arnaud
MVP - VC

lallous
3/27/2007 5:24:32 PM
Hello

I am writing managed c++/c++ native code.

We have soem buffer passed as char* from native, and we want to pass to a
managed MemoryStream object.

Is it possible to have a Byte [] reference that char* and then we set the
Byte[] size?

Or this:
http://msdn2.microsoft.com/en-us/library/tz333b9s(vs.80).aspx
Is the only suggest way?

The reason I look for an alternative is that because I come fron a native
background and copying memory over and over is a concern.

--
Elias

AddThis Social Bookmark Button