|
From: Lasse Kärkkäi. <tr...@us...> - 2009-12-02 00:53:49
|
Module: performous
Branch: master
Commit: 92cac693dc33e725e35833ff98670be8acf40c94
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Dec 2 02:53:28 2009 +0200
Removed dllhelper, libda and plugin++ can only compile as static on Windows, libda plugins should get proper DLL declarations
---
libs/libda/include/libda/audio.hpp | 13 +++++++------
libs/libda/include/libda/audio_dev.hpp | 4 ++++
libs/libda/plugins/CMakeLists.txt | 5 +----
libs/libda/src/audio.cpp | 4 +---
libs/plugin++/include/plugin++/dll.hpp | 5 +++--
libs/plugin++/include/plugin++/dllhelper.hpp | 24 ------------------------
libs/plugin++/include/plugin++/plugin.hpp | 21 +++++++++++++++++++--
libs/plugin++/src/dll.cc | 2 --
8 files changed, 35 insertions(+), 43 deletions(-)
diff --git a/libs/libda/include/libda/audio.hpp b/libs/libda/include/libda/audio.hpp
index 4626f36..e2828f8 100644
--- a/libs/libda/include/libda/audio.hpp
+++ b/libs/libda/include/libda/audio.hpp
@@ -14,7 +14,6 @@ future versions (which hopefully will bring API and ABI compatibility).
#include "sample.hpp"
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
-#include <plugin++/dllhelper.hpp>
#include <cmath>
#include <cstddef>
#include <iosfwd>
@@ -22,6 +21,8 @@ future versions (which hopefully will bring API and ABI compatibility).
#include <string>
#include <vector>
+#define LIBDA_API
+
namespace da {
class init_impl;
@@ -31,7 +32,7 @@ namespace da {
* so that you can create multiple da::initialize objects.
* Do not, however, destroy the object while audio devices are still in use!
**/
- class DLL_PUBLIC initialize {
+ class LIBDA_API initialize {
init_impl* m_impl;
public:
initialize();
@@ -73,8 +74,8 @@ namespace da {
typedef boost::function<bool (pcm_data& it)> callback_t;
struct settings {
- DLL_PUBLIC static const std::size_t low;
- DLL_PUBLIC static const std::size_t high;
+ LIBDA_API static const std::size_t low;
+ LIBDA_API static const std::size_t high;
settings(std::string const& devstr = ""):
m_channels(high),
m_channels_near(true),
@@ -143,7 +144,7 @@ namespace da {
bool special() const { return !m_name.empty() && m_name[0] == '~'; }
};
- class DLL_PUBLIC record {
+ class LIBDA_API record {
public:
typedef std::vector<devinfo> devlist_t;
static devlist_t devices();
@@ -154,7 +155,7 @@ namespace da {
dev* m_handle;
};
- class DLL_PUBLIC playback {
+ class LIBDA_API playback {
public:
typedef std::vector<devinfo> devlist_t;
static devlist_t devices();
diff --git a/libs/libda/include/libda/audio_dev.hpp b/libs/libda/include/libda/audio_dev.hpp
index 10970f2..b27412f 100644
--- a/libs/libda/include/libda/audio_dev.hpp
+++ b/libs/libda/include/libda/audio_dev.hpp
@@ -8,6 +8,10 @@ This requires linking with libda and the ABI is not stable yet. The API might
also change.
**/
+#ifdef BUILDING_DA
+#define PLUGIN_MASTER
+#endif
+
#include <libda/audio.hpp>
#include <plugin++/plugin.hpp>
diff --git a/libs/libda/plugins/CMakeLists.txt b/libs/libda/plugins/CMakeLists.txt
index 0686be3..4606599 100644
--- a/libs/libda/plugins/CMakeLists.txt
+++ b/libs/libda/plugins/CMakeLists.txt
@@ -165,10 +165,7 @@ if(PLUGIN_TESTING)
add_library(da_audio_dev_tone MODULE audio_dev_tone.cpp)
install(TARGETS da_audio_dev_tone DESTINATION ${LibDA_PLUGIN_DIR})
if(APPLE OR WIN32)
- target_link_libraries(da_audio_dev_tone da)
- if(WIN32)
- target_link_libraries(da_audio_dev_tone plugin++)
- endif(WIN32)
+ target_link_libraries(da_audio_dev_tone da plugin++)
endif(APPLE OR WIN32)
endif(PLUGIN_TESTING)
diff --git a/libs/libda/src/audio.cpp b/libs/libda/src/audio.cpp
index 5dfb894..e1a8ecc 100644
--- a/libs/libda/src/audio.cpp
+++ b/libs/libda/src/audio.cpp
@@ -1,7 +1,5 @@
-#define BUILDING_DLL // So that we get dllexports everywhere instead of dllimports (this is some Windows crap)
+#define BUILDING_DA
#include <libda/audio_dev.hpp>
-#undef BUILDING_DLL
-
#include <libda/config.h>
#include <plugin++/loader.hpp>
#include <ostream>
diff --git a/libs/plugin++/include/plugin++/dll.hpp b/libs/plugin++/include/plugin++/dll.hpp
index 39aa091..51de65e 100644
--- a/libs/plugin++/include/plugin++/dll.hpp
+++ b/libs/plugin++/include/plugin++/dll.hpp
@@ -2,10 +2,11 @@
#ifndef DLL_HPP_INCLUDED
#define DLL_HPP_INCLUDED
-#include "dllhelper.hpp"
#include <stdexcept>
#include <string>
+#define Plugin_API
+
namespace plugin {
/// \brief Exception class for signaling runtime errors from class dll
@@ -15,7 +16,7 @@ namespace plugin {
};
/// \brief Dynamic library loader
- class DLL_PUBLIC dll {
+ class Plugin_API dll {
void* lib;
public:
/// Open a dynamic library
diff --git a/libs/plugin++/include/plugin++/dllhelper.hpp b/libs/plugin++/include/plugin++/dllhelper.hpp
deleted file mode 100644
index 612ab08..0000000
--- a/libs/plugin++/include/plugin++/dllhelper.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#undef DLL_PUBLIC
-
-#if defined _WIN32 || defined __CYGWIN__
-
-// A hack to allow static library build (for now) -Tronic
-#define DLL_PUBLIC
-#if 0
-#ifdef BUILDING_DLL
-#define DLL_PUBLIC __declspec(dllexport)
-#else
-#define DLL_PUBLIC __declspec(dllimport)
-#endif
-#endif
-
-#else
-
-#if __GNUC__ >= 4
-#define DLL_PUBLIC __attribute__ ((visibility("default")))
-#else
-#define DLL_PUBLIC
-#endif
-
-#endif
-
diff --git a/libs/plugin++/include/plugin++/plugin.hpp b/libs/plugin++/include/plugin++/plugin.hpp
index 3222e79..6c635c6 100644
--- a/libs/plugin++/include/plugin++/plugin.hpp
+++ b/libs/plugin++/include/plugin++/plugin.hpp
@@ -2,11 +2,28 @@
#ifndef PLUGIN_HPP_INCLUDED
#define PLUGIN_HPP_INCLUDED
-#include "dllhelper.hpp"
#include <map>
#include <stdexcept>
#include <string>
+#if defined _WIN32 || defined __CYGWIN__
+
+#ifdef PLUGIN_MASTER
+#define PLUGIN_REGISTRY_API __declspec(dllexport)
+#else
+#define PLUGIN_REGISTRY_API __declspec(dllimport)
+#endif
+
+#else
+
+#if __GNUC__ >= 4
+#define PLUGIN_REGISTRY_API __attribute__ ((visibility("default")))
+#else
+#define PLUGIN_REGISTRY_API
+#endif
+
+#endif
+
namespace plugin {
/**
@@ -25,7 +42,7 @@ namespace plugin {
template <typename Base,
typename Arg = std::string const&,
typename Key = std::string>
- class DLL_PUBLIC registry {
+ class PLUGIN_REGISTRY_API registry {
public:
typedef Base base_type;
typedef Arg arg_type;
diff --git a/libs/plugin++/src/dll.cc b/libs/plugin++/src/dll.cc
index e6dcef8..21e69b8 100644
--- a/libs/plugin++/src/dll.cc
+++ b/libs/plugin++/src/dll.cc
@@ -1,6 +1,4 @@
-#define BUILDING_DLL
#include <plugin++/dll.hpp>
-#undef BUILDING_DLL
#include <stdexcept>
|