Boost logo

Boost Users :

From: Robert Vinluan (rvinluan_at_[hidden])
Date: 2006-02-13 10:24:00


Leon Mergen wrote:
>
> Huh ? I don't understand... forgive me for my ignorance, since I'm
> probably missing your point, but I just, for example, #include
> <boost/iostreams/stream.hpp> and it just works, without linking to any
> special lib... what exactly are your needs that require linking against
> a lib? Or is it that bzip2/zlib support needs linking with a boost
> library ?
>
> Regards,
>
> Leon Mergen
> http://www.solatis.com/

Hi Leon,

Thanks for the response. I read my message again and found that it
wasn't very clear.

Anyway, I'm building the boost iostreams library with zlib support.
When I build it as a static library on Windows (i.e.
libboost_iostreams-*.lib), everything works fine. I can include the
iostreams headers in my code and link my project to the library without
any problems.

However, when I build iostreams as a dynamic library and link my project
to its import library (i.e. boost_iostreams-*.lib), I receive linker
errors about unresolved symbols. The unresolved symbols are symbols
from the iostreams' zlib component.

I did a symbol listing and found that all the symbols declared in
./boost/iostreams/filter/zlib.hpp were available in the static library,
but not in the import library. So it seems that the corresponding
implementation file, ./libs/iostreams/src/zlib.cpp, is not being
compiled into the dynamic library.

So I checked the docs and found a small paragraph stating that if I
wanted to include zlib.hpp in my code, then I needed to add zlib.cpp to
my project as well as define the preprocessor symbol BOOST_IOSTREAMS_NO_LIB.

Here's a link to the doc page:
        http://www.boost.org/libs/iostreams/doc/installation.html
It's the first paragraph under the "Building with an IDE or Makefile"
section.

Anyway, I followed the doc page and added zlib.cpp to my project. I
recompiled and relinked to the dynamic library and everything worked.

The doc page appears to backup my finding that zlib.cpp isn't being
compiled into the dynamic version of the iostreams library. So my
question is .... why? Why is zlib.cpp compiled into the static version
of the iostreams library, but not the dynamic version?

I would really like to link against a dynamic version of iostreams with
zlib support without explicitly adding zlib.cpp to my project. Has
anyone been able to do this successfully?

Thanks,
Rob


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net