Jason Nye | 1 Dec 01:12
Favicon

Building boost 1.33.1 64-bit using VC-8

Hello all,

 

First of all, I want to say boost has been totally awesome for the programming team in which I work. Kudos to everyone contributing!

 

For skimmers, #3 is the one that has a question related to it.

 

I’m trying to build boost 1.33.1 64-bit using VC-8 (team suite) and I’ve run into some (minor) issues. They are:

  1. The vc-8_0-x86_amd64-tools.jam does not refer to the correct vcvars batch file. It specifies $(VC_ROOT)\bin\x86_amd64\VCVARSamd64.bat but there isn’t any such file. The proper file is $(VC_ROOT)\bin\x86_amd64\vcvarsx86_amd64.bat

  2. The thread library doesn’t link because of the ice_wrapper used in once.cpp (in compare_exchange line 119). Replacing the compare_exchange with an actual call to InterlockedCompareExchange did the trick. I believe this is because it is an intrinsic function.

  3. This one is the most confusing to me: the abi prefix headers perform #pragma pack(push, 8). No warnings pop up in 32-bit mode because 8 bytes is the default alignment. However, in 64-bit mode, the default alignment is 16 bytes. Why would boost ever want to enforce a specific packing? Is it safe for me to simply comment these out? I *really* don’t like the idea of enforcing an 8 byte alignment when the default is 16 bytes. Any comments here?

 

Thanks!

Jason.

 

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Robert Ramey | 1 Dec 03:03

Bjam quesion

Better repost with a different title to catch a bjam expert.

Lawrence Spector wrote:
> Ok, so basically I need to change the default in bjam to turn off
> wchar_t as a native type, because our project has issues with some
> legacy code which wouldn't comply otherwise.  Any idea how to disable
> this in bjam?  I searched through and couldn't find anything in any of
> the jam files that indicated that this setting was either on or off.
>
> Thanks again for the help,
>
> Lawrence
>
> -----Original Message-----
> From: boost-users-bounces <at> lists.boost.org
> [mailto:boost-users-bounces <at> lists.boost.org] On Behalf Of Robert Ramey
> Sent: Thursday, November 30, 2006 4:53 PM
> To: boost-users <at> lists.boost.org
> Subject: Re: [Boost-users] [Serialization] Linker
> ErrorsUsingUnicode(Was:errorC2027:useofundefinedtype'boost::serializatio
> n::extended_type_info_null<T>'?)
>
> I'm not sure that's true.  What is necessary is that the switch
> setting must
> be the same as when the library is built.  I presume its been built
> with
>
> bjam so its not readily apparent what the switch setting the library
> is actually built with.  I'm quite sure that this is ok as vc 6.5
> tests work
> and this version of compiler only has wchar_t defined as a 16 bit
> integer.
>
> Lawrence Spector wrote:
>> Ok, I was playing with the compiler settings and figured it out.
>> Apparently, in order to use this, you *must* have wchar_t treated as
>> a built-in type setting on in VC7.1.  Ah ha.  Maybe there's a good
>> spot to document that.
>
> I'll stick it in.
>
>
>>
>> Thanks for the assistance,
>>
>> Lawrence
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users 
Jaakko Järvi | 1 Dec 05:39
Picon

Re: Boost Lamdba: Binding to overloaded operator and templated functions???

Hello Haroon,

On Nov 30, 2006, at 12:37 AM, Haroon Khan wrote:

> Jaakko,
> Thanks for your reply, I tried some of your suggestions and they are
> still giving me compile errors. Here is some code that Ive been
> playing with. This was compiled in VC8.
>
> struct some_functor
> {
> private:
>     int x_;
> public:
>     template<typename SOMETYPE>
>     some_functor& template_foo(SOMETYPE x){
>         std::cout<<boost::format("Calling %x.%s(%d)\n") % this %  
> __FUNCTION__%x;
>         return *this;
>     }
> };

> void test16
> {
>     PRINT_FUNCTION_NAME;
>     using namespace boost::lambda;
>     int a[] = {1, 2, 3, 4, 5, 6, 7, 8};
>     std::vector<int> v(a, a+sizeof(a)/sizeof(int));
>
>
>     (bind(&(some_functor::template_foo<int>), some_functor(),
> _1))(boost::cref(1))
>

The arguments given to bind at the time of call to bind (e.g.  
some_functor) are stored as
const copies. Thus some_functor will be const, and when the functor  
is called, you are trying to
call a non-const member with a const object.

Here's one way to fix it:

     some_functor s;
     (bind(&some_functor::template_foo<int>, boost::ref(s),
	  _1))(boost::cref(1));

Cheers, Jaakko
abir basak | 1 Dec 08:13
Picon

circular_buffer doc

Hi,
  I am not finding documentation for boost::circular_buffer which is in 
the sandbox (Though I had seen some documentation of it a few months back).
  Can somebody point out a link for the documentation ? or give a line 
or two showing difference between space_optimized_circular_buffer and 
circular_buffer ?

Thanks
abir

--

-- 
Abir Basak, Member IEEE
Software Engineer, Read Ink Technologies
B. Tech, IIT Kharagpur
email: abir <at> abirbasak.com
homepage: www.abirbasak.com
Jens Müller | 1 Dec 10:35
Picon
Favicon

Re: [graph] leda_graph.hpp and LEDA 5.0.1

Jens Müller wrote:
> The example doesn't work with LEDA 5.0.1 any longer:

As simple as that: Add

using namespace leda;

at an appropriate point ...

E.g.:

| int main()
| {
|   using namespace boost;
|   using namespace leda;
|   typedef GRAPH<std::string, char> graph_t;

Maybe

| #undef string
| #undef vector

have also become unnecessary?
John Maddock | 1 Dec 11:07
Picon

Re: [Serialization] LinkerErrorsUsingUnicode(Was:errorC2027:useofundefinedtype'boost::serialization::extended_type_info_null<T>'?)

Lawrence Spector wrote:
> Ok, so basically I need to change the default in bjam to turn off
> wchar_t as a native type, because our project has issues with some
> legacy code which wouldn't comply otherwise.  Any idea how to disable
> this in bjam?  I searched through and couldn't find anything in any of
> the jam files that indicated that this setting was either on or off.

bjam -sBUILD="<native-wchar_t>off debug release" -sTOOLS=vc-7_1

should do it.

John.
John Maddock | 1 Dec 11:04
Picon

Re: BOOST_STATIC_CONST

Michael Held wrote:
> hi,
>
> I am using BOOST_STATIC_CONST for static class members of a base
> class. I have following situation:
>
> template <int T>
> class A
> {
>   typedef typename MyType<T>::value_type value_type;
>   BOOST_STATIC_CONST(typename value_type::some_type, MY_CONSTANT = 0);
> };
>
> template <int T>
> class B : public A<T>
> {
>   typedef A<T> Base;
>   typedef typename Base::value_type value_type;
>   BOOST_STATIC_CONST(typename value_type::some_type, MY_CONSTANT =
> Base::MY_CONSTANT);
> };
>
> or
>
> template <int T>
> class B : public A<T>
> {
>   typedef A<T> Base;
>   typedef typename Base::value_type value_type;
>   using Base::MY_CONSTANT;
> };
>
>
> for both cases I got a linker error:
> /usr/bin/ld: Undefined symbols:
> B<0>::MY_CONSTANT
>
> what am I doing wrong?
> I am using darwin gcc4.0.1 and Boost from CVS

In theory you are doing nothing wrong, linker errors like that should only 
occur if you take the address of the constant: in that case you would need 
an out-of-line definition as well:

template<int T>
type_of_constant B<T>::MY_CONSTANT;

I'll leave it to you to figure out what "type_of_constant" is ! :-)

You would need to wrap this in

#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION

#endif

if you want the code to be portable, but if you really are taking the 
constant's address then it won't be portable to older compilers anyway 
(since you can't take the address of an enum which is what 
BOOST_STATIC_CONSTANT uses in those cases).

HTH, John.
John Maddock | 1 Dec 11:12
Picon

Re: configure boost on cygwin

Shan wrote:
> Hi,
>
> I'm trying to use boost in a cygwin enviroment. I've installed the
> boost-1_33_1 libraries using the cygwin setup program. I have a
> makefile to compile a simple program but I keep getting the error.
>
> $ make
> g++ -c -O3 cash_flow.cpp

Note the command line, the boost include path isn't there, so you need to 
adjust your makefile.

I'm also a little surprised not to see a message that <boost/shared_ptr.hpp> 
couldn't be found.  Just tripple checking, but you did include that file in 
cash_flow.cpp didn't you :-)

You don't need to link to any external libs to use shared_ptr either.

HTH, John.

> In file included from cash_flow.cpp:6:
> cash_flow.h:12: error: `boost' has not been declared
> cash_flow.h:12: error: ISO C++ forbids declaration of `shared_ptr'
> with
> no type
> cash_flow.h:12: error: expected `;' before '<' token
> make: *** [cash_flow.o] Error 1
>
> I'm new to Unix like environments and am not able to setup the
> makefile properly. Below is what I have
>
> TARGET    = main
> CPP       = g++
> CPPFLAGS  = -O3
> INCLUDES  = -I/usr/include/boost-1_33_1
> LDFLAGS   =
> LIBS      = -lboost_1_33_1
> SOURCES   = $(wildcard *.cpp)
> DEPENDS   = $(SOURCES:%.cpp=%.d)
> OBJECTS   = $(DEPENDS:%.d=%.o)
> TMPS      = $(wildcard *.hpp~) $(wildcard *.cpp~)
>
> $(TARGET) : $(OBJECTS)
>    $(CPP) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
>
> clean :
>    rm -rf $(TARGET) $(DEPENDS) $(OBJECTS) $(TMPS)
>
> $(DEPENDS) : %.d : %.cpp
>    set -e; $(CPP) -MM $(CPPFLAGS) $< \
>        | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
>        [ -s $@ ] || rm -f $@
>
> $(OBJECTS) : %.o : %.cpp
>    $(CPP) -c $(CPPFLAGS) $<
>
> .PHONY : clean
>
> include $(DEPENDS)
>
>
> I also tried using the includes/library names
>
> I tried that as well
>
> INCLUDES  = -I/usr/include/boost-1_33_1
> LDFLAGS   = -L/usr/lib
> LIBS      = -lboost_1_33_1
>
> and
>
> $(OBJECTS) : %.o : %.cpp
>    $(CPP) -c $(CPPFLAGS) $(INCLUDES) $<
>
> Still get the same error ..
>
> Can someone tell me which libboost*.a should I point to as there are
> many .. for eg to use boost::shared_ptr?
>
> Thanks
> S.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users 
Sebastian Weber | 1 Dec 11:29
Picon

[random] Four-Tap Shift Register RNG

Hello everyone!

I'm using quite a lot of Boost libraries and have by the time
implemented some bits which enhance some parts of the library. E.g. I
ported a four-tap shift register random number generator to the random
number library. I herby post the code as it might be interesting for
others since this type of random number generator is known to produce
random numbers with very low 2 and 3 point correlations (see
http://arxiv.org/abs/cond-mat/9710104 ). The code is partially taken
from the gsl-library and extended to 64bit unsigned integers which gives
random numbers of very high precision. However, you can use this code
only with the latest random number library from Boost CVS as the numbers
returned use the full range of 32bit or 64bit unsigned ints, which
causes overflows with the code in boost 1.33.1 and 1.34_RC. So please
have look at the code and submit it into CVS if the code is any good.

Greetings,

Sebastian Weber
Attachment (four_tap2.hpp): text/x-c++hdr, 5637 bytes
_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Steven T. Hatton | 1 Dec 13:03

boost::weak_ptr and boost::intrusive_ptr

Why is there no counterpart for boost::weak_ptr that works with 
boost::intrusive_ptr?  It's certainly possible to set up cycles with 
boost::intrusive_ptr.  A simple example where intrusive_ptr is the right 
thing to use, and where the problem arrises is a tree structure.  It is 
sometimes useful to maintain a bidirectional pointer relationship between 
children and parent nodes in a tree.  Ideally, deleting the root of a tree 
will cascade down to delete all intermediate and leaf nodes which are not 
referenced by some other object.  If both the downward and upward pointers 
are intrusive, removing the pointer to the root will result in orphaned data 
because the upward pointers prevent the root node from being deleted, while 
the downward pointers prevent the child nodes (and their upward pointers) 
from being removed.  

Intrusive pointers are, IMO, the correct mechanism to hold a tree together.  
They are efficient, effective, and easy to understand.  They work better than 
shared pointers for recursive data structures.  Unfortunately the lack of a 
corresponding weak_ptr to go with  boost::intrusive_ptr means I either use a 
raw pointer to the parent, devise a strategy for decrementing the pointers 
myself, or create my own weak pointer.  All of these options detract 
significantly from the value of boost::intrusive_ptr.

I have the impression that in the past people have used intrusive pointers for 
the "wrong things", and this has caused them to get an overall bad 
reputation.  IMO, they do have a place in good software design.

Any thoughts on this topic?

Steven

Gmane