Boost logo

Boost-Build :

Subject: Re: [Boost-build] Problem linking iostream with zlib support under Windows
From: k h (xerceslist.kh_at_[hidden])
Date: 2010-01-05 02:25:54

The following example uses boost::iostreams with zlib support. It works and
compiles fine under Linux (once the toolset is changed to gcc and the
__declspecs removed). This is with BOOST_BUILD_PATH, ZLIB_SOURCE, NO_BZIP2
set, and starting with a boost distribution that has just bjam (and nothing
else) compiled.

It does not work under Windows however. Starting with an unpacked boost
distribution, it will compile compile zlib only to fail to find it almost
immediately afterwards when linking the dll. I have tried a small example
that uses a different boost library (e.g. date_time), and that compiles and
links fine with a substantially identical jamfile.

What do I change so the example below compiles under Windows without having
to do something like bjam --build-type=complete first? Many thanks.

Background: I am trying to make a demo distribution of a new library that
would download boost and then compile the library and (only) the necessary
parts of boost. This already works fine under Cygwin/Linux.

I'll be very grateful for any help.

==== Jamroot.jam ======

import boost ;
boost.use-project ;

using msvc : 9.0express ;

lib l : lib.cpp /boost//iostreams : <link>shared:<define>BOOST_

exe blah : blah.cpp l ;

==== blah.cpp =======

extern __declspec(dllimport) void blah();

int main()
       blah ();

==== lib.cpp =======

#include <iostream>
#include <ostream>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/config/warning_disable.hpp>

namespace io = boost::iostreams;

__declspec(dllexport) void blah()
    io::filtering_ostream out;

    out << 123;
    std::cout << "Done" << std::endl;


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at