|
Boost-Build : |
Subject: Re: [Boost-build] bjam and libraries
From: Michel Krämer (michel_at_[hidden])
Date: 2009-12-25 06:49:15
Hi!
The .lib file is not created because you're exporting nothing from your
library. Change the following line
void blah ()
to
__declspec(dllexport) void blah ()
and everything should work as expected.
Regards,
Michel
Am 25.12.2009 11:10, schrieb k h:
> I wondered if someone could help me understand bjam a bit better. Below
> is a small project that does not work as is, but can be fixed by adding
> <link>static to the mylib line. Without it, a dll is produced for the
> library, and the executable fails to link.
>
> Background: I am trying to write a bjam file for a new library. I would
> like it to build and run unit-tests on all possible configurations when
> --build-type=complete is specified, so cannot just hardwire static
> linking in.
>
> Many thanks.
>
>
> import boost ;
> boost.use-project ;
>
> using msvc : : "D:/Program Files/Microsoft Visual Studio
> 9.0/VC/bin/cl.exe" ;
>
> # adding <link>static at the end of the next line makes the problem go away
> lib mylib : testlib.cpp : <library>/boost//iostreams ;
>
> exe testmain : testmain.cpp : <library>mylib <library>/boost//iostreams ;
>
> ----------------
> testlib.cpp
> ----------------
>
> #include <ostream>
> #include <boost/iostreams/device/file.hpp>
> #include <boost/iostreams/stream.hpp>
>
> namespace io = boost::iostreams;
>
> void blah ()
> {
> io::stream_buffer<io::file_sink> buf("log.txt");
> std::ostream out(&buf);
> out << "Hello";
> }
>
> --------------------
> testmain.cpp
> --------------------
>
> extern void blah (void);
>
> int main ()
> {
> blah ();
> }
>
>
>
>
>
> _______________________________________________
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
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