[ngcore] DLL exports

This commit is contained in:
Matthias Hochsteger 2018-12-07 13:08:00 +01:00
parent 69769fc628
commit 0dc04b661c
4 changed files with 24 additions and 10 deletions

View File

@ -1,7 +1,7 @@
add_definitions(-DNGINTERFACE_EXPORTS)
add_library(ngcore basearchive.cpp)
set_target_properties(ngcore PROPERTIES POSITION_INDEPENDENT_CODE ON )
target_compile_definitions(ngcore PRIVATE -DNGCORE_EXPORTS)
install(TARGETS ngcore DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen)

View File

@ -4,7 +4,7 @@
namespace ngcore
{
// BinaryOutArchive ======================================================================
class DLL_HEADER BinaryOutArchive : public Archive
class NGCORE_API BinaryOutArchive : public Archive
{
size_t ptr = 0;
enum { BUFFERSIZE = 1024 };
@ -82,7 +82,7 @@ namespace ngcore
};
// BinaryInArchive ======================================================================
class DLL_HEADER BinaryInArchive : public Archive
class NGCORE_API BinaryInArchive : public Archive
{
std::map<std::string, VersionInfo> vinfo;
std::shared_ptr<std::istream> fin;
@ -150,7 +150,7 @@ namespace ngcore
};
// TextOutArchive ======================================================================
class DLL_HEADER TextOutArchive : public Archive
class NGCORE_API TextOutArchive : public Archive
{
std::shared_ptr<std::ostream> fout;
public:
@ -204,7 +204,7 @@ namespace ngcore
};
// TextInArchive ======================================================================
class DLL_HEADER TextInArchive : public Archive
class NGCORE_API TextInArchive : public Archive
{
std::map<std::string, VersionInfo> vinfo;
std::shared_ptr<std::istream> fin;

View File

@ -9,7 +9,7 @@ namespace ngcore
void SetLibraryVersion(const std::string& library, VersionInfo version);
class Archive;
DLL_HEADER std::string demangle(const char* typeinfo);
NGCORE_API std::string demangle(const char* typeinfo);
// create new pointer of type T if it is default constructible, else throw
template<typename T>
@ -34,7 +34,7 @@ namespace ngcore
static constexpr std::false_type check(...);
typedef decltype(check<T>(0)) type;
public:
DLL_HEADER static constexpr bool value = type::value;
NGCORE_API static constexpr bool value = type::value;
};
// Check if class is archivable
@ -49,7 +49,7 @@ namespace ngcore
static constexpr std::false_type check(...);
typedef decltype(check<T>(nullptr)) type;
public:
DLL_HEADER static constexpr bool value = type::value;
NGCORE_API static constexpr bool value = type::value;
};
struct ClassArchiveInfo
@ -66,7 +66,7 @@ namespace ngcore
};
// Base Archive class
class DLL_HEADER Archive
class NGCORE_API Archive
{
bool is_output;
// how many different shared_ptr/pointer have been (un)archived
@ -454,7 +454,7 @@ namespace ngcore
};
template<typename T, typename ... Bases>
class DLL_HEADER RegisterClassForArchive
class NGCORE_API RegisterClassForArchive
{
public:
RegisterClassForArchive()

View File

@ -15,6 +15,20 @@
#include <cstring>
#include <complex>
#ifdef WIN32
#define NGCORE_API_EXPORT __declspec(dllexport)
#define NGCORE_API_IMPORT __declspec(dllimport)
#else
#define NGCORE_API_EXPORT
#define NGCORE_API_IMPORT
#endif
#ifdef NGCORE_EXPORTS
#define NGCORE_API NGCORE_API_EXPORT
#else
#define NGCORE_API NGCORE_API_IMPORT
#endif
namespace ngcore
{
#if defined(__GNUC__)