rename_namespace ( #import )

When importing a type library it could be at times cumbersome to use the default namespace name. #import provides a nice option called rename_namespace. Use… [sourcecode language=’cpp’]#import “SomeTypelib.tlb” rename_namespace( “NibuNamespace” )[/sourcecode] Using no_namespace is lazy programming 😐 . Namespaces reduces name collision hence usage should be encouraged.
Continue reading…

 

MIDL “string” attribute

Sometime back I was wondering about whether there was a way to transfer our good ol’ NULL terminated strings using COM apart from using BSTR’s. That’s how I bumped into “string” attribute provided by MIDL. Here is how we use it… [sourcecode language=’cpp’]typedef [string] char NormalString[1024]; [id(1), helpstring( “Displays null terminated UNICODE strings” )] HRESULT […]
Continue reading…