Boost logo

Boost :

Subject: Re: [boost] [system][chrono] header-only libs
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-10-17 17:37:41


----- Original Message -----
From: "Marsh Ray" <marsh_at_[hidden]>
To: <boost_at_[hidden]>
Cc: "Anthony Williams" <anthony.ajw_at_[hidden]>
Sent: Friday, October 15, 2010 12:07 AM
Subject: Re: [boost] [system][chrono] header-only libs

>
> On 10/14/2010 01:53 AM, Anthony Williams wrote:
>> "vicente.botet"<vicente.botet_at_[hidden]> writes:
>>> As there are quite a lot of files that includes some parts of
>>> <windows.h> some of them include the same declarations. I was
>>> wondering if we can not add a boost/detail/windows.hpp> file that will
>>> declare whatever is needed in Boost. Is this a good or a bad idea?
>>
>> I think that's a bad idea, as lots of libraries will need to touch it,
>> and it will end up getting big and bloated like<windows.h>. A
>> boost/details/windows directory with a lot of special-purpose files
>> would be better.
>
> If it gets too big you can split it into separate files later. I
> wouldn't worry about it unless it starts to become a problem.

Hi,

I have started to define some files that allows to build Boost.Chrono and Boost.System without including <windows.h> file.

basic_types.hpp // contain the basic types
error_handling.hpp // error handling related
time.hpp // time related
process.hpp // process related
thread.hpp // thread related

The file name follows the naming of the main sections in http://msdn.microsoft.com/en-us/library/ee663300%28v=VS.85%29.aspx

The user need to define BOOST_USE_WINDOWS_H if s/he prefers to use the <windows.h> file.

These files should be modified and surely add new ones in order to provide everything the Boost lib needs.

You can see them in the sandbox http://svn.boost.org/svn/boost/sandbox/chrono/boost/detail/win/

I have started to write some test that checks if the layout is the same (see
http://svn.boost.org/svn/boost/sandbox/chrono/libs/chrono/test/win32_test.cpp). Where these kind of test should be placed?

Anthony please, could you help me to fix this

// @FIXME Which condition must be tested
// #if !defined(_M_IX86)
                typedef __int64 LONGLONG_;
// #else
// typedef double LONGLONG_;
// #endif

If I uncomment the commented lines, I get an run time error in my machine AMD Athlon 62x2 Dual.

I have reached to make Boost.System and Boost.Chrono header_only libs. The user needs to define BOOST_SYSTEM_INLINED and BOOST_CHRONO_INLINED respectively, but maybe a better name could be BOOST_SYSTEM_HEADER_ONLY and BOOST_CHRONO_HEADER_ONLY.

You can see them in the sandbox http://svn.boost.org/svn/boost/sandbox/chrono/boost/system/
and http://svn.boost.org/svn/boost/sandbox/chrono/libs/system/

Beman, I have changed a little bit the logic under cygwin as the current version didn't work. Instead of

# if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
# define BOOST_WINDOWS_API
# else
# define BOOST_POSIX_API
# endif

I have defined

# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
# define BOOST_SYSTEM_WINDOWS_API
# else
# define BOOST_SYSTEM_POSIX_API
# endif

Note the change in the macro name, so conflicts with other libs is avoided.
                           
With this little change every thing works now. I guess it is too late to merge these changes on the release branch, but at least the chage in the cygwin condition should be worth.

Anyway, please let me know if this is the correct way to go and if this windows files could be incorporated in Boost.

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk