Groups | Blog | Home
all groups > visual c > july 2003 >

visual c : Parameters visible in C# as 'ref' args ?



Steve Terepin
7/26/2003 11:53:22 AM
I've been trying to make a Managed C++ method that appears with the =
following signature in C# :

void Func ( ref bool cancelRequest )=20

.... but if I declare it in C++ as simply=20

void Func ( bool & cancelRequest )

.... it appears in the C# world as ( bool * ).

I've tried adorning the declaration with attributes like this :

void Func (=20
[System::Runtime::InteropServices::InAttribute]
[System::Runtime::InteropServices::OutAttribute]
bool & cancelRequest=20
) ;

.... but that doesn't do the trick.

Any ideas, anyone ?

Mattias Sjögren
7/27/2003 1:27:48 AM
Steve,

[quoted text, click to view]

Try

void Func( bool __gc* cancelRequest )

or

void Func( System::Boolean *cancelRequest )



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Steve Terepin
7/30/2003 2:22:33 PM
Thanks, that works now :)))

And if I want the arg to appear as 'out' rather than 'ref', I simply apply
the InteropServices 'OutAttribute'. Nice !!

S.

[quoted text, click to view]

AddThis Social Bookmark Button