summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2014-04-08 15:59:55 (GMT)
committer Amir Taaki <genjix@riseup.net>2014-04-08 15:59:55 (GMT)
commit561765c0f6abfd85617d50d1570a8dfb11f47a71 (patch)
tree75ddca7c8e1c10676a41facb34cc3e314e97c787
parent48fd8ffedf732c56a44e85d938e90c6a81a0b812 (diff)
added define.hpp with shared lib / DLL visibility macros.
-rw-r--r--include/bitcoin/Makefile.am1
-rw-r--r--include/bitcoin/define.hpp63
2 files changed, 64 insertions, 0 deletions
diff --git a/include/bitcoin/Makefile.am b/include/bitcoin/Makefile.am
index fb10876..85fb7f2 100644
--- a/include/bitcoin/Makefile.am
+++ b/include/bitcoin/Makefile.am
@@ -1,5 +1,6 @@
bitcoin_includedir = $(includedir)/bitcoin
bitcoin_include_HEADERS = \
+ define.hpp \
transaction_indexer.hpp \
satoshi_serialize.hpp \
getx_responder.hpp \
diff --git a/include/bitcoin/define.hpp b/include/bitcoin/define.hpp
new file mode 100644
index 0000000..0f3b123
--- /dev/null
+++ b/include/bitcoin/define.hpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
+ *
+ * This file is part of libbitcoin.
+ *
+ * libbitcoin is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License with
+ * additional permissions to the one published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version. For more information see LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef LIBBITCOIN_DEFINE_HPP
+#define LIBBITCOIN_DEFINE_HPP
+
+// See http://gcc.gnu.org/wiki/Visibility
+
+// Generic helper definitions for shared library support
+#if defined _WIN32 || defined __CYGWIN__
+ #define BC_HELPER_DLL_IMPORT __declspec(dllimport)
+ #define BC_HELPER_DLL_EXPORT __declspec(dllexport)
+ #define BC_HELPER_DLL_LOCAL
+#else
+ #if __GNUC__ >= 4
+ #define BC_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
+ #define BC_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
+ #define BC_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
+ #else
+ #define BC_HELPER_DLL_IMPORT
+ #define BC_HELPER_DLL_EXPORT
+ #define BC_HELPER_DLL_LOCAL
+ #endif
+#endif
+
+// Now we use the generic helper definitions above to
+// define BC_PUBLIC and BC_PRIVATE.
+// BC_PUBLIC is used for the public API symbols. It either DLL imports or
+// DLL exports (or does nothing for static build)
+// BC_PRIVATE is used for non-api symbols.
+
+#ifdef BC_DLL
+ #ifdef BC_DLL_EXPORTS
+ // Being compiled as a DLL (instead of using it)
+ #define BC_PUBLIC BC_HELPER_DLL_EXPORT
+ #else
+ #define BC_PUBLIC BC_HELPER_DLL_IMPORT
+ #endif
+ #define BC_PRIVATE BC_HELPER_DLL_LOCAL
+#else
+ // BC_DLL is not defined: this means FOX is a static lib.
+ #define BC_PUBLIC
+ #define BC_PRIVATE
+#endif
+
+#endif
+