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 - 29 Jun 2005 13:10 GMT
>What must the declaration of the method look like?
Probably
Object *Foo(Boolean b)
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Boris - 29 Jun 2005 14:07 GMT
>> What must the declaration of the method look like?
>
> Probably
>
> Object *Foo(Boolean b)
Which is converted to this IDL:
HRESULT Foo([in] unsigned char b, [out, retval] VARIANT *ptr)
Any other idea?
Boris
Boris - 29 Jun 2005 14:21 GMT
I got it:
Object *Foo([MarshalAsAttribute(UnmanagedType::VariantBool)]Boolean b)
See
http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondefaultmarshalingforbo
oleans.asp?frame=true.
Boris