com - Why we want to use BSTR -


I'm new to COM according to BSTR, there is a string with the prefix I am thinking that its purpose for BSTR In which case we have to use BSTR instead of string type? If one can be an example, please? Thank you

First of all, sometimes you have to use BSTR. For example, if you call a com method and call Cali a BSTR, then do not pass any other string type - otherwise they can call SysStringLen () and Can run in undefined behavior. Use BSTR when an API description says that you should use BSTR.

In addition, there are useful features in BSTR :

  • (most importantly this) is allocated on a separate pile managed by the com And so if your application has different modules using different modules, then any module can be assigned a BSTR and any module can free it easily with other dynamic allocated accessories. This is not an example New is very useful when for example you have an existing string, Cali or have to be specified: it preserved or re - without a single stack and a set of allocation functions which would have hard times.
  • (less important thing) This Automation is supported by Marshall so that you can easily use it in the COM interface which should be marble and not crafting and registering proxy-stub stuff.
  • (at least significant IMO) may contain embedded blank characters in contrast to other common string types

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -