Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam and libraries
From: k h (xerceslist.kh_at_[hidden])
Date: 2009-12-25 11:22:23


> The .lib file is not created because you're exporting nothing from your
> library. Change the following line
>

Many thanks, and sorry for asking a question that turned out to be
completely unrelated to Boost. Your fix worked fine, and I am hoping that
with it in place I should be able to get the code to compile using a
portable jamfile?

It now works better, so the counterexample is a little longer. Again, the
addition of <link>static makes the code compile, but this time it complains
about multiply defined symbols within zlib if it is not specified. What am
I doing wrong this time? Many thanks.

import boost ;
boost.use-project ;

using msvc : : "D:/Program Files/Microsoft Visual Studio 9.0/VC/bin/cl.exe"
;

BOOST_LIB = d:/boost_1_41_0/stage/lib ;

lib mylib : testlib.cpp :
   <library>/boost//iostreams
   <link>static #breaks if this is removed
   <library-path>$(BOOST_LIB)
;

exe testmain : testmain.cpp : <library>mylib <library-path>$(BOOST_LIB) ;

----------------
testlib.cpp
----------------

#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.push(boost::iostreams::zlib_compressor(boost::iostreams::zlib_params(boost::iostreams::zlib::default_compression)));
    out.push(boost::iostreams::file_sink("my_file.txt"));
}

--------------------
testmain.cpp
--------------------

extern void blah (void);

int main ()
{
  blah ();
}



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk