debian: fixed broken debian/*.install target files
[barry/progweb.git] / src / dll.h
blob862704e6ec0423339e5da85cb177b6d7f8b4fa73
1 ///
2 /// \file dll.h
3 /// Macros for handling DLL/library API visibility
4 ///
5 /// Based on documentation at: http://gcc.gnu.org/wiki/Visibility
6 ///
8 /*
9 Copyright (C) 2005-2011, 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:
37 // private:
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")))
56 #else
58 #define BXEXPORT
59 #define BXLOCAL
61 #endif
65 // Add this to the end of variable argument function declarations.
66 // For example:
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
74 // 'this' pointer:
76 // class Trace {
77 // public:
78 // void logf(const char *msg, ...) BARRY_GCC_FORMAT_CHECK(2, 3);
79 // };
81 #if __GNUC__
82 #define BARRY_GCC_FORMAT_CHECK(a,b) __attribute__ ((format(printf, a, b)))
83 #else
84 #define BARRY_GCC_FORMAT_CHECK(a,b)
85 #endif
87 #endif