# Re: BSTR data type

**URL:** <https://www.ruby-forum.com/t/re-bstr-data-type/94399>\
**Category:** Ruby\
**Created:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/re-bstr-data-type/94399 "2006-05-03T18:57:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/re-bstr-data-type/94399/1 "2006-05-03T18:57:44Z")

</div>

> (at least directly). Does anyone have code to do so? How  
> about the variant data type? (I am not talking about COM  
> server libraries that could be called with Win32OLE.)

BSTR is a wide string, so your declaration would be ‘P’ (or  
‘L’ if you plan on passing addresses around).

I’ve never dealt with BSTR directly, but it looks like you may  
have to manipulate your strings with MultiByteToWideChar() and  
WideCharToMultiByte() first, before passing them to whatever  
function you use that requires BSTR data types.

If you can provide an example of something you’re having  
trouble with we can probably help you better.

Regards,

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.
