Groups | Blog | Home
all groups > dotnet interop > june 2005 >

dotnet interop : Managed C++ equivalent for Foo([in] VARIANT_BOOL b, [out, retval] VARIANT *ptr)


Boris
6/29/2005 12:00:00 AM
I have an interface in Managed C++ where one of the methods is this one:

Object *Foo(Boolean *b)

When I use tlbexp to check the IDL the line above is converted to:

HRESULT Foo([in, out] VARIANT_BOOL *b, [out, retval] VARIANT *ptr)

However I need:

HRESULT Foo([in] VARIANT_BOOL b, [out, retval] VARIANT *ptr)

What must the declaration of the method look like?

Thanks in advance,
Boris

Mattias Sjögren
6/29/2005 12:00:00 AM
[quoted text, click to view]

Probably

Object *Foo(Boolean b)



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Boris
6/29/2005 12:00:00 AM
[quoted text, click to view]

Which is converted to this IDL:

HRESULT Foo([in] unsigned char b, [out, retval] VARIANT *ptr)

Any other idea?

Boris

Boris
6/29/2005 12:00:00 AM
I got it:

Object *Foo([MarshalAsAttribute(UnmanagedType::VariantBool)]Boolean b)

See
http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondefaultmarshalingforbooleans.asp?frame=true.

Boris

AddThis Social Bookmark Button