HighTechTalks DotNet Forums  

CCW COM and Parameters

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss CCW COM and Parameters in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
James
 
Posts: n/a

Default CCW COM and Parameters - 04-25-2009 , 08:18 PM






I am writing a component in C# which is a COM Callable Wrapper. Some of the
methods pass structs across COM. My question is, how does COM pass
parameters such as structs? I know that C# passes structs by value. The
struct data being passed from the Win32 client is never going to be modified,
so I would like to prevent making a copy of the struct across the COM
barrier. In C# The struct is being passed by reference (added ref keyword to
parameter) since I don't want to make a copy there either. I'm going through
enough layers already and I would prefer not to be making multiple copies of
a struct every time it is passed as a parameter.

Thanks!

--
James


Reply With Quote
  #2  
Old   
Pavel Minaev
 
Posts: n/a

Default Re: CCW COM and Parameters - 04-26-2009 , 05:07 AM






On Apr 25, 6:18*pm, James <baodurasp... (AT) community (DOT) nospam> wrote:
Quote:
I am writing a component in C# which is a COM Callable Wrapper. *Some of the
methods pass structs across COM. *My question is, how does COM pass
parameters such as structs?
It's up to you, depending on how you define the interface.

Quote:
*I know that C# passes structs by value. *The
struct data being passed from the Win32 client is never going to be modified,
so I would like to prevent making a copy of the struct across the COM
barrier. *In C# The struct is being passed by reference (added ref keyword to
parameter) since I don't want to make a copy there either. *I'm going through
enough layers already and I would prefer not to be making multiple copiesof
a struct every time it is passed as a parameter.
If your C# code defines the argument as "ref" or "out", there should
be no copy involved during marshaling, unless the struct itself has
some fields that require special marshaling (e.g. strings, or arrays
declared without "fixed" keyword).


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.