3 /// Macros for handling DLL/library API visibility
5 /// Based on documentation at: http://gcc.gnu.org/wiki/Visibility
9 Copyright (C) 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 See the GNU General Public License in the COPYING file at the
21 root directory of this project for more details.
24 #ifndef __BARRY_DLL_H__
25 #define __BARRY_DLL_H__
29 // Every non-templated class that is meant to be used by an application
30 // must be declared as:
32 // class BXEXPORT ClassName {};
34 // Every private (not protected or public) member function of an exported
35 // class can be declared as:
38 // BXLOCAL void HelperFunc();
40 // Every non-templated function that is meant to be used by an application
41 // must be declared as:
43 // BXEXPORT int GetAmount();
44 // BXEXPORT std::ostream& operator<< (std::ostream& os, const Obj &obj);
47 // Everything else will be hidden, as per the build system's configuration.
51 #if __BARRY_HAVE_GCCVISIBILITY__
53 #define BXEXPORT __attribute__ ((visibility("default")))
54 #define BXLOCAL __attribute__ ((visibility("hidden")))
65 // Add this to the end of variable argument function declarations.
68 // void log(const char *msg, ...) BARRY_GCC_FORMAT_CHECK(1, 2);
70 // This tells GCC that the first argument is the format string, and
71 // the second is the first variable argument to check.
73 // If you use this inside a class, you need to allow for the invisible
78 // void logf(const char *msg, ...) BARRY_GCC_FORMAT_CHECK(2, 3);
82 #define BARRY_GCC_FORMAT_CHECK(a,b) __attribute__ ((format(printf, a, b)))
84 #define BARRY_GCC_FORMAT_CHECK(a,b)