Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > openwatcom.users.c_cpp > #3550
| From | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| Newsgroups | openwatcom.users.c_cpp |
| Subject | Re: is _bstr_t not defined in Watcom ? |
| Date | 2018-08-07 12:41 -0500 |
| Organization | OpenWatcom |
| Message-ID | <pkclfp$vk6$1@www.openwatcom.org> (permalink) |
| References | (1 earlier) <pk27h0$1mbd$1@gioia.aioe.org> <v8lbmdt7urktsk4vqurreesd5gvqdlvdle@4ax.com> <11p86vVJT4Oe-pn2-OdZLHYWKuBd6@slamain> <pka6dt$hic$1@www.openwatcom.org> <t1ijmdlsbvvl9n94189op7fo6lnb6tg1l9@4ax.com> |
On 8/7/2018 11:32 AM, Paul S. Person wrote:
> On Mon, 6 Aug 2018 14:12:19 -0500, Lynn McGuire
> <lynnmcguire5@gmail.com> wrote:
>
>> Yes, OW is sadly getting out of date.
>
> While I can understand this viewpoint,
> I don't see that OW has any obligation to support vendor-specific APIs
> at all
> except, of course, by being able to link to their libraries -- that
> is, to resolve any calling convention issues.
>
> The commercial product was, IIRC, in direct competition with the
> Microsoft compilers, and so had some reason to support
> Microsoft-specific APIs. But OW does not, IMHO, beyond what I said
> above.
>
> Have you tried linking with the libraries listed in the web page you
> cited? If they are (as I suspect) used to link to DLLs, have you tried
> generaing equivalent libraries with wlib (or wlink? it's been so long
> since I did anything like this that I have forgotten), which would use
> the same "decoration" as the OW compiler/linker?
I wrote my own _bstr_t method (not finished yet as I need to see who is
calling it).
#ifdef __WATCOMC__
// from comutil.h
class _bstr_t;
// Construct a _bstr_t from a const whar_t*
//
std::string _bstr_t (const wchar_t * s)
// : m_Data(new Data_t(s))
{
// if (m_Data == NULL) {
// _com_issue_error(E_OUTOFMEMORY);
// }
alert ("The Watcom C version of _bstr_t was called !");
return "";
}
#endif
And I replaced the critical _bstr_t calls with modified code to use
BSTRs directly:
// UTF-8 to wide
std::wstring wnewSheetName;
UTF8toWide (newSheetName.c_str (), wnewSheetName);
// the _bstr_t does not work with Watcom C++ so use BSTR
// _bstr_t sheetNameNewBstr = _bstr_t (newSheetName.c_str ());
BSTR sheetNameNewBstr = SysAllocString (wnewSheetName.c_str ());
fnameNew.bstrVal = sheetNameNewBstr;
OLEMethod (DISPATCH_PROPERTYPUT, & result4, pExcelSheet, L"Name",
"Set the name of the new sheet in the active spreadsheet
(ConnectToNewSheet)", 1, fnameNew);
int res = result4.vt;
VariantClear ( & fnameNew);
Thanks,
Lynn
Back to openwatcom.users.c_cpp | Previous | Next — Previous in thread | Next in thread | Find similar
is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-02 16:29 -0500
Re: is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-03 11:15 -0500
Re: is _bstr_t not defined in Watcom ? Paul S. Person <psperson@ix.netscom.com.invalid> - 2018-08-03 09:18 -0700
Re: is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-03 14:05 -0500
Re: is _bstr_t not defined in Watcom ? Paul S. Person <psperson@ix.netscom.com.invalid> - 2018-08-04 09:31 -0700
Re: is _bstr_t not defined in Watcom ? Johann Klammer <klammerj@NOSPAM.a1.net> - 2018-08-03 20:39 +0200
Re: is _bstr_t not defined in Watcom ? Paul S. Person <psperson@ix.netscom.com.invalid> - 2018-08-04 09:33 -0700
Re: is _bstr_t not defined in Watcom ? "Steven Levine" <steve53@nomail.earthlink.net> - 2018-08-05 01:34 +0000
Re: is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-06 14:12 -0500
Re: is _bstr_t not defined in Watcom ? Paul S. Person <psperson@ix.netscom.com.invalid> - 2018-08-07 09:32 -0700
Re: is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-07 12:41 -0500
Re: is _bstr_t not defined in Watcom ? Lynn McGuire <lynnmcguire5@gmail.com> - 2018-08-07 12:43 -0500
csiph-web