[botan-devel] DLL_BOTAN

john skaller skaller at users.sourceforge.net
Tue Jan 29 18:11:43 EST 2013


On 30/01/2013, at 4:39 AM, Jack Lloyd wrote:

> On Sun, Jan 27, 2013 at 02:19:45AM +1100, john skaller wrote:
>> On OSX this macro is set to:
>> 
>> #ifndef BOTAN_DLL
>>  #define BOTAN_DLL __attribute__((visibility("default")))

> Visibility support is actually quite useful under modern compilers
> like GCC and Clang as knowing that certain code is private to the
> module allows better interprocedular / whole program analysis.

I doubt gcc or Clang can do that. Clang can't even optimise
a function very well (LLVM actually). Only the linker could do such
an analysis, its the only one that actually knows which files
are being combined.

> Additionally reducing the number of exported symbols can purportedly
> cut down on shared object load time, though likely botan doesn't have
> enough symbols for that to be a huge factor anyway.

Right. So Unix is playing catchup to Windows.

I have to say I'm disappointed the ISO C++ Standards committee
didn't standardise this for C++11. They chose to standardise the
attribute syntax instead, and picked a syntax incompatible
with all known compilers :)

> 
>> and the idea is to override on the command line, when building a DLL,
>> however there's no way to specify a value for a macro on the command line
>> AFAIK. 
> 
> Under VC, /DBOTAN_DLL=__declspec(dllimport) should work.


Right, but it makes the command line build options
platform dependent, which they need not be. 
--
john skaller
skaller at users.sourceforge.net
http://felix-lang.org






More information about the botan-devel mailing list