www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - Pantheios 1.0.1-beta58 and CComBSTR, comstl::bstr compilation failures on VC8 (with stlsoft 1.9.9)

reply "Brett Delle Grazie" <brett.dellegrazie uk.logicalis.com> writes:
Dear Matthew,

I'm having issues attempting to use CComBSTR or the comstl::bstr facade with 
pantheios.  It appears that the string shims for CComBSTR or comstl::bstr 
are not being picked up by
the pantheios library.  I've produced a very simple test case below to 
demonstrate and the stdafx.h header and build log follow:

I've had a look at the source and it appears that the string shims for the 
CComBSTR should be being picked up by the compiler but as you can see from 
the build log they are not.
A similar problem appears when trying to use comstl::bstr class.

I honestly don't know if this is an error in my header imports, an error in 
the stlsoft headers or a compiler bug so I hope you can shed some light.

btw - I've been a user of the stlsoft libraries for several years now and 
all I can say is: fantastic work!

Thanks,

Best Regards,

Brett Delle Grazie

-- unittest.cpp --
#include "stdafx.h"

#include <pantheios/pantheios.hpp>

int _tmain(int argc, _TCHAR* argv[])

{

CComBSTR aString( _T("Test String") );

pantheios::log_INFORMATIONAL( aString );

return 0;

}

------------------------

-- stdafx.h --

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently, but

// are changed infrequently

//

#pragma once

// Modify the following defines if you have to target a platform prior to 
the ones specified below.

// Refer to MSDN for the latest info on corresponding values for different 
platforms.

#ifndef WINVER // Allow use of features specific to Windows XP or later.

#define WINVER 0x0501 // Change this to the appropriate value to target 
other versions of Windows.

#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or 
later.

#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to 
target other versions of Windows.

#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or 
later.

#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to 
target Windows Me or later.

#endif

#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.

#define _WIN32_IE 0x0600 // Change this to the appropriate value to target 
other versions of IE.

#endif

// Don't warn on use of old insecure string copy variants.

#define _CRT_SECURE_NO_WARNINGS 1

// Overload and automatically call secure versions of string copy variants.

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 1

#include <stdio.h>

#include <tchar.h>

#include <pantheios/implicit_link/core.h>

#include <pantheios/implicit_link/fe.simple.h>

#include <pantheios/implicit_link/be.WindowsDebugger.h>

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will 
be explicit

#include <atlbase.h>

#include <atlstr.h>

// TODO: reference additional headers your program requires here

-----------------------------------------------------------

-- Build Log --

1>------ Rebuild All started: Project: unittest, Configuration: Debug 
Win32 ------

1>Deleting intermediate and output files for project 'unittest', 
configuration 'Debug|Win32'

1>Compiling...

1>stdafx.cpp

1>Implicit linking to Pantheios libraries: 
(pantheios.1.$(XXXX).vc8.dll.debug.lib)

1> pantheios.1.core.vc8.dll.debug.lib

1> pantheios.1.fe.simple.vc8.dll.debug.lib

1> pantheios.1.bec.WindowsDebugger.vc8.dll.debug.lib

1> pantheios.1.be.WindowsDebugger.vc8.dll.debug.lib

1>Compiling...

1>unittest.cpp

1>c:\projects\extlibs\stlsoft-1.9.9\include\winstl\window\functions.h(213) : 
warning C4312: 'reinterpret_cast' : conversion from 'LONG' to 'HINSTANCE' of 
greater size

1>c:\projects\extlibs\stlsoft-1.9.9\include\winstl\window\functions.h(365) : 
warning C4244: 'argument' : conversion from 'LRESULT' to 'const long', 
possible loss of data

1>c:\projects\pantheios-1.0.1-beta58\include\pantheios\internal\generated\log_sev
functions.hpp(7230) 
: error C2665: 'stlsoft::winstl_project::c_str_len_a' : none of the 17 
overloads could convert all the argument types

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(775): 
could be 'size_t pantheios::c_str_len_a(const pantheios::pan_slice_t &)'

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(822): or 
'size_t pantheios::c_str_len_a(const pantheios::pan_slice_t *)'

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(849): or 
'size_t pantheios::c_str_len_a(pantheios::pan_severity_t)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\acces
\string\fwd.h(100): 
or 'stlsoft::ss_size_t stlsoft::c_str_len_a(const stlsoft::ss_char_a_t *)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\string\std
exception.hpp(128): 
or 'stlsoft::ss_size_t stlsoft::c_str_len_a(const std::exception &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\string\std\ba
ic_string.hpp(392): 
or 'stlsoft::ss_size_t stlsoft::c_str_len_a(const std::string &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\strin
\std\time.hpp(131): 
or 'stlsoft::ss_size_t stlsoft::c_str_len_a(const tm *)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\strin
\std\time.hpp(242): 
or 'stlsoft::ss_size_t stlsoft::c_str_len_a(const tm &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\comstl\shims\access\s
ring\guid.hpp(300): 
or 'stlsoft::comstl_project::cs_size_t 
stlsoft::comstl_project::c_str_len_a(const GUID &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\comstl\shims\access\stri
g\variant.hpp(592): 
or 'stlsoft::comstl_project::cs_size_t 
stlsoft::comstl_project::c_str_len_a(const VARIANT &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\hwnd.hpp(541): 
or 'stlsoft::winstl_project::ws_size_t 
stlsoft::winstl_project::c_str_len_a(HWND)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(553): 
or 'stlsoft::winstl_project::ws_size_t 
stlsoft::winstl_project::c_str_len_a(const SYSTEMTIME &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(600): 
or 'stlsoft::winstl_project::ws_size_t 
stlsoft::winstl_project::c_str_len_a(const FILETIME &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(633): 
or 'stlsoft::winstl_project::ws_size_t 
stlsoft::winstl_project::c_str_len_a(const UDATE &)'

1> while trying to match the argument list '(const ATL::CComBSTR)'

1> c:\projects\remedyhelper\unittest\unittest.cpp(12) : see reference to 
function template instantiation 'int 
pantheios::log_INFORMATIONAL<ATL::CComBSTR>(const T0 &)' being compiled

1> with

1> [

1> T0=ATL::CComBSTR

1> ]

1>c:\projects\pantheios-1.0.1-beta58\include\pantheios\internal\generated\log_sev
functions.hpp(7230) 
: error C2665: 'stlsoft::winstl_project::c_str_data_a' : none of the 17 
overloads could convert all the argument types

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(764): 
could be 'const char *pantheios::c_str_data_a(const pantheios::pan_slice_t 
&)'

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(811): or 
'const char *pantheios::c_str_data_a(const pantheios::pan_slice_t *)'

1> c:\projects\pantheios-1.0.1-beta58\include\pantheios\pantheios.h(838): or 
'const char *pantheios::c_str_data_a(pantheios::pan_severity_t)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\acce
s\string\fwd.h(93): 
or 'const stlsoft::ss_char_a_t *stlsoft::c_str_data_a(const 
stlsoft::ss_char_a_t *)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\string\st
\exception.hpp(97): 
or 'const stlsoft::ss_char_a_t *stlsoft::c_str_data_a(const std::exception 
&)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\string\std\ba
ic_string.hpp(226): 
or 'const stlsoft::ss_char_a_t *stlsoft::c_str_data_a(const std::string &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\stri
g\std\time.hpp(96): 
or 'stlsoft::basic_shim_string<C> stlsoft::c_str_data_a(const tm *)'

1> with

1> [

1> C=stlsoft::ss_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\stlsoft\shims\access\strin
\std\time.hpp(229): 
or 'stlsoft::basic_shim_string<C> stlsoft::c_str_data_a(const tm &)'

1> with

1> [

1> C=stlsoft::ss_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\comstl\shims\access\s
ring\guid.hpp(258): 
or 'stlsoft::comstl_project::c_str_ptr_GUID_proxy<C> 
stlsoft::comstl_project::c_str_data_a(const GUID &)'

1> with

1> [

1> C=stlsoft::comstl_project::cs_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\comstl\shims\access\stri
g\variant.hpp(482): 
or 'stlsoft::comstl_project::c_str_VARIANT_proxy_a 
stlsoft::comstl_project::c_str_data_a(const VARIANT &)'

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\hwnd.hpp(509): 
or 'stlsoft::winstl_project::c_str_ptr_HWND_proxy<C> 
stlsoft::winstl_project::c_str_data_a(HWND)'

1> with

1> [

1> C=stlsoft::winstl_project::ws_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(330): 
or 'stlsoft::basic_shim_string<C> 
stlsoft::winstl_project::c_str_data_a(const SYSTEMTIME &)'

1> with

1> [

1> C=stlsoft::ss_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(364): 
or 'stlsoft::basic_shim_string<C> 
stlsoft::winstl_project::c_str_data_a(const FILETIME &)'

1> with

1> [

1> C=stlsoft::ss_char_a_t

1> ]

1> 
c:\projects\extlibs\stlsoft-1.9.9\include\winstl\shims\access\s
ring\time.hpp(396): 
or 'stlsoft::basic_shim_string<C> 
stlsoft::winstl_project::c_str_data_a(const UDATE &)'

1> with

1> [

1> C=stlsoft::ss_char_a_t

1> ]

1> while trying to match the argument list '(const ATL::CComBSTR)'

1>Build log was saved at 
"file://c:\projects\RemedyHelper\unittest\Debug\BuildLog.htm"

1>unittest - 2 error(s), 2 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Nov 23 2007
parent "Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
"Brett Delle Grazie" <brett.dellegrazie uk.logicalis.com> wrote in message
news:fi6ikf$28e5$1 digitalmars.com...
 Dear Matthew,

 I'm having issues attempting to use CComBSTR or the comstl::bstr facade
with
 pantheios.  It appears that the string shims for CComBSTR or comstl::bstr
 are not being picked up by
 the pantheios library.  I've produced a very simple test case below to
 demonstrate and the stdafx.h header and build log follow:

 I've had a look at the source and it appears that the string shims for the
 CComBSTR should be being picked up by the compiler but as you can see from
 the build log they are not.
 A similar problem appears when trying to use comstl::bstr class.

 I honestly don't know if this is an error in my header imports, an error
in
 the stlsoft headers or a compiler bug so I hope you can shed some light.
Ah, the answer here is very simple. Pantheios currently only supports multibyte strings. I've just updated the Pantheios roadmap, and have posted it on this newsgroup. I am hoping to get 1.0 final release before the end of the year, and 1.1 (with Unicode support) in mid/late January. For the moment, you'll just have to do a conversion, or use multibyte source code. ;-(
 btw - I've been a user of the stlsoft libraries for several years now and
 all I can say is: fantastic work!
Thanks! I might quote you on the re-vamping website. :-) Please feel free to respond on the other thread with any requests you have for 1.10. Cheers Matt
Nov 23 2007