|
Boost : |
From: Michael Fink (michael.fink_at_[hidden])
Date: 2006-05-05 08:40:46
Hi,
I'm currently trying to port Boost to evc4 and while porting some
questions arised that should be answered before.
1. There are some parts of the sourcecode where Ansi Win32-API-functions
are used, e.g. CreateFileA. These are not supported under Windows CE. Some
projects provided workaround when BOOST_NO_ANSI_APIS is defined and called
e.g. the CreateFileW function instead. The functions often use std::string
as parameters, and so string converting must be done. Now my question: is
there a "best practice" way to do string conversions in Boost?
Boost.Thread in one place uses the A2CW macro that comes from the ATL
header atlconv.h to do string conversion (file
boost/libs/thread/src/once.cpp). I had to include the necessary files at
the top of this file to get it to compile. Is this the way it should be
done on systems where ATL is available?
2. There are some parts in sourcecode where I have to do system-specific
code for Windows CE. What is the preferred way to do that, introduce a
BOOST_xx macro or use the one that is already defined by the compiler
(that would be _WIN32_WCE). An example would be this:
#if defined(__BORLANDC__)
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD
dwReason, LPVOID /*lpReserved*/)
#elif defined(_WIN32_WCE)
extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason,
LPVOID /*lpReserved*/)
#else
extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason,
LPVOID /*lpReserved*/)
#endif
I guess as compiler-specific defines are used throughout the sourcecode,
it's okay to use a macro like _WIN32_WCE.
That's it.
bye
Michael
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk