- Include dynC_API in the list of versioned libraries.
- Define DYNC_EXPORT and use it for createSnippet.
---
CMakeLists.txt | 2 +-
dynC_API/CMakeLists.txt | 3 ++-
dynC_API/h/dynC.h | 30 +++++++++++++++++++++---------
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 180db4020d44..1ef860547c47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,7 +124,7 @@ endif()
if(NOT ${PLATFORM} MATCHES nt)
SET_TARGET_PROPERTIES (
common dynElf dynDwarf instructionAPI symtabAPI symLite parseAPI
- patchAPI pcontrol stackwalk dyninstAPI
+ patchAPI pcontrol stackwalk dyninstAPI dynC_API
PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${LIBVERSION}
diff --git a/dynC_API/CMakeLists.txt b/dynC_API/CMakeLists.txt
index 43c871e9ee64..49a032a1913f 100644
--- a/dynC_API/CMakeLists.txt
+++ b/dynC_API/CMakeLists.txt
@@ -4,13 +4,14 @@ file(GLOB SRC_LIST "src/*.C")
include_directories(h src ../dyninstAPI/src)
set_source_files_properties(${SRC_LIST} PROPERTIES LANGUAGE CXX)
+add_definitions(-DDYNC_EXPORTS)
add_library(dynC_API ${SRC_LIST})
add_library(dynC_API_static STATIC ${SRC_LIST})
file (GLOB headers "h/*.h")
set_target_properties(dynC_API dynC_API_static PROPERTIES PUBLIC_HEADER "${headers}")
-target_link_libraries (dynC_API dyninstAPI)
+target_link_private_libraries (dynC_API dyninstAPI)
install(TARGETS dynC_API dynC_API_static
EXPORT DyninstTargets
diff --git a/dynC_API/h/dynC.h b/dynC_API/h/dynC.h
index acd5913306ab..e7baf9c437be 100644
--- a/dynC_API/h/dynC.h
+++ b/dynC_API/h/dynC.h
@@ -40,19 +40,31 @@
#include <string>
#include <map>
+#if !defined(DYNC_EXPORT)
+ #if defined(_MSC_VER)
+ #if defined(DYNC_EXPORTS)
+ #define DYNC_EXPORT __declspec(dllexport)
+ #else
+ #define DYNC_EXPORT __declspec(dllimport)
+ #endif
+ #else
+ #define DYNC_EXPORT __attribute__((visibility ("default")))
+#endif
+#endif
+
namespace dynC_API{
- BPatch_snippet *createSnippet(const char *s, BPatch_point &point);
- std::map<BPatch_point *, BPatch_snippet *> *createSnippet(const char *s, std::vector<BPatch_point *> points);
+ DYNC_EXPORT BPatch_snippet *createSnippet(const char *s, BPatch_point &point);
+ DYNC_EXPORT std::map<BPatch_point *, BPatch_snippet *> *createSnippet(const char *s, std::vector<BPatch_point *> points);
- BPatch_snippet *createSnippet(FILE *f, BPatch_point &point);
- std::map<BPatch_point *, BPatch_snippet *> *createSnippet(FILE *f, std::vector<BPatch_point *> points);
+ DYNC_EXPORT BPatch_snippet *createSnippet(FILE *f, BPatch_point &point);
+ DYNC_EXPORT std::map<BPatch_point *, BPatch_snippet *> *createSnippet(FILE *f, std::vector<BPatch_point *> points);
- BPatch_snippet *createSnippet(std::string str, BPatch_point &point);
- std::map<BPatch_point *, BPatch_snippet *> *createSnippet(std::string str, std::vector<BPatch_point *> points);
+ DYNC_EXPORT BPatch_snippet *createSnippet(std::string str, BPatch_point &point);
+ DYNC_EXPORT std::map<BPatch_point *, BPatch_snippet *> *createSnippet(std::string str, std::vector<BPatch_point *> points);
- BPatch_snippet *createSnippet(const char *s, BPatch_addressSpace &addSpace);
- BPatch_snippet *createSnippet(FILE *f, BPatch_addressSpace &addSpace);
- BPatch_snippet *createSnippet(std::string str, BPatch_addressSpace &addSpace);
+ DYNC_EXPORT BPatch_snippet *createSnippet(const char *s, BPatch_addressSpace &addSpace);
+ DYNC_EXPORT BPatch_snippet *createSnippet(FILE *f, BPatch_addressSpace &addSpace);
+ DYNC_EXPORT BPatch_snippet *createSnippet(std::string str, BPatch_addressSpace &addSpace);
//dynC internal
std::string mangle(const char *varName, const char *snippetName, const char *typeName);
--
1.9.3
|