ConvertStringToBSTR is declared in comutils.h.
You can use ConvertBSTRToString to get your char* back from BSTR if needed in C++ application.
Printable View
ConvertStringToBSTR is declared in comutils.h.
You can use ConvertBSTRToString to get your char* back from BSTR if needed in C++ application.
Hello..,
I have tried using BSTR but i want my DLL to be compatible in C, Borland C++, VB, VC++, Java and .Net..so if i use BSTR then i wont be able to use it in basic 'C'., is there any other way to do so...
Perhaps the standard way of exposing functionality developed in C++ to an automation client like VB is by using COM. i.e. Making your class Automation-COM compliant will allow you to use functionality using standard VB syntax, like this -Quote:
Originally Posted by cheery_poori
Further read:Code:Set objectName = CreateObject ("YourDllName.ClassName")
objectName.DoSomething ()
The approach you have chosen so far is to use the export functionality of a "C" style DLL - a relatively outdated mechnism when compared to DLLs programmed in C++ that are COM compliant.
- Post + Sample: Invoking functionality in a C++ COM DLL from VB Script Client
- Post + Sample: Invoking functionality in a C++ COM DLL from VB.NET Client
COM compliance brings with it the advantage of adhering to standards designed for cross-language programming capabilities.
What a mistake! BSTR type is a generic type for COM. Since COM is applicable for basic 'C' (is it a surprise for you?), so the BSTR type does.Quote:
Originally Posted by cheery_poori
And what about Borland C++? Do you think it's kinda extraterrestrial in Windows world? Or C++ world? :)