interop: Passing pointer to COM to efficiently receive large data chunk
- From: "Robert Schnitzer" <rschnitzerNO_SPAM@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 12 Jun 2005 09:21:18 -0400
I'm writing COM to expose some unmanaged imagery generation functions to c#.
My question is how to best (easiest, clearest coding style) pass a managed
pointer to COM to receive back a loaded image:
example 1: using safearray
COM:
process([in,out] SAFEARRAY* bytes)
C# call:
byte[] bytes = byte[256];
process(bytes);
Question: does this pass a pointer, or is it marshalled (i.e inefficient)?
example 2: using fixed array size
COM:
process([in,out] byte[256] bytes]
Disadvantage: fixed size must be specified up front -- or is it safe to
write past the apparently "fixed" array size internal to the com function if
the true size of array is also passed as a parameter? (i.e in the case that
image size should vary fro 256?)
What it the current wisdom of how to do this best?
thanks in advance.
-Robert
.
- Follow-Ups:
- Re: interop: Passing pointer to COM to efficiently receive large data chunk
- From: Mattias Sjögren
- Re: interop: Passing pointer to COM to efficiently receive large data chunk
- Prev by Date: Re: Socket Messages To/From Unmanaged Application
- Next by Date: <Object> Custom Server control
- Previous by thread: AppDomain.Unload leaks ?
- Next by thread: Re: interop: Passing pointer to COM to efficiently receive large data chunk
- Index(es):
Relevant Pages
|