Boost logo

Boost :

Subject: [boost] [config] gcc,msvc,mingw visibility
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-04-23 01:19:03

I've been enabling limited gcc visibility so that it works similarly to msvc
*_DECL attributes and will export from the DLL/DSO only those symbols which
need to be exported.

I've had a lot of difficulty with this.

I followed the instructions

which more or less boil down to using BOOST_SYMBOL_EXPORT when functions are
exported, BOOST_SYMBOL_IMPORT when functions are imported, and
BOOST_SYMBOL_VISIBLE on class declarations.

I set my Jamfile.v2 in the library build to enable gcc visibility=hidden and
let her rip.

After the more or less normal back and forth it seemed that the library
built and work on all platforms/compilers. .... EXCEPT Mingw. Hmmmm -
this shouldn't be too tough, just look at how the other libraries did it.
Turns out that it seems that no boost libraries actually enable gcc
visibility in their builds - at least as far as I can tell. (I didn't dig
into the depths of jam tools files). After a fair amount of research I
concluded that for windows platforms - regardless of whether they are built
with minnow (gcc) or mdvc, one needs to define BOOST_SYMBOL_VISIBLE as
BOOST_SYMBOL_IMPORT or BOOST_SYMBOL_IMPORT which of course makes things more

So here is what I came up with.

My questions are:

a) did I do this right?
b) is there a simpler way
c) if the answer to the above is no - can the documentation be updated?

Robert Ramey

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at