[botan-devel] DLL_BOTAN

Joel Low joel at joelsplace.sg
Sun Jan 27 06:51:56 EST 2013

Hmm, I don't really understand why you would need to be exporting Botan's
symbols? Since you're building it as a shared library, shouldn't you be
importing it instead of exporting?

Yes, build.h is included in everything (could have changed), and when
compiling the DLL on Windows -DBOTAN_DLL=__declspec(dllexport), as generated
in the Makefile by configure.py


-----Original Message-----
From: botan-devel [mailto:botan-devel-bounces at randombit.net] On Behalf Of
john skaller
Sent: Saturday, 26 January 2013 11:20 PM
To: Botan development list
Subject: [botan-devel] DLL_BOTAN

Botan has a macro DLL_BOTAN set to support Windows DLL builds.
It's inconsistent where it puts it:


src/utils/charset.h:bool BOTAN_DLL is_digit(char c);


src/utils/parsing.h:BOTAN_DLL u32bit to_u32bit(const std::string& str);

On OSX this macro is set to:

#ifndef BOTAN_DLL
  #define BOTAN_DLL __attribute__((visibility("default")))

in build/build/h by:

src/build-data/buildh.in:  #define BOTAN_DLL %{visibility_attribute}

[It seems to work but I see no point specifying it on unix platforms, why
introduce a non-standard feature?]

I think (not sure) build.h gets included in everything.

I'm not sure how this can work. My guess is that on Windows:

#define BOTAN_DLL __declspec(dllimport)

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. So you'd need two build.h files, one for use and a secret one just
for building.
My build system does it like this:

#if !defined(FLX_STATIC_LINK) && FLX_WIN32 #define FLX_EXPORT
__declspec(dllexport) #define FLX_IMPORT __declspec(dllimport) #else #define
FLX_EXPORT #define FLX_IMPORT #endif


which is sensitive to 3 macros:

FLX_WIN32 which is based on MSC_VER or whatever.
FLX_STATIC_LINK which is set on the command line for static linkage on any
platform BUILD_BOTAN which is set on the command line when building BOTAN
into  shared library on any platform

This only requires -DMACRO_NAME without a value, and the specification is
platform independent.

john skaller
skaller at users.sourceforge.net

botan-devel mailing list
botan-devel at randombit.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6053 bytes
Desc: not available
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20130127/f0e5675b/attachment.p7s>

More information about the botan-devel mailing list