diff --git a/include/SQLiteCpp/Backup.h b/include/SQLiteCpp/Backup.h index ecdd847..8a5d966 100644 --- a/include/SQLiteCpp/Backup.h +++ b/include/SQLiteCpp/Backup.h @@ -32,7 +32,7 @@ namespace SQLite * See also the a reference implementation of live backup taken from the official site: * https://www.sqlite.org/backup.html */ -class DLL_API Backup +class SQLITECPP_API Backup { public: /** diff --git a/include/SQLiteCpp/Column.h b/include/SQLiteCpp/Column.h index 21bd9d3..fbe2c1a 100644 --- a/include/SQLiteCpp/Column.h +++ b/include/SQLiteCpp/Column.h @@ -23,11 +23,11 @@ struct sqlite3_stmt; namespace SQLite { -DLL_API extern const int INTEGER; ///< SQLITE_INTEGER -DLL_API extern const int FLOAT; ///< SQLITE_FLOAT -DLL_API extern const int TEXT; ///< SQLITE_TEXT -DLL_API extern const int BLOB; ///< SQLITE_BLOB -DLL_API extern const int Null; ///< SQLITE_NULL +SQLITECPP_API extern const int INTEGER; ///< SQLITE_INTEGER +SQLITECPP_API extern const int FLOAT; ///< SQLITE_FLOAT +SQLITECPP_API extern const int TEXT; ///< SQLITE_TEXT +SQLITECPP_API extern const int BLOB; ///< SQLITE_BLOB +SQLITECPP_API extern const int Null; ///< SQLITE_NULL /** * @brief Encapsulation of a Column in a row of the result pointed by the prepared Statement. @@ -45,7 +45,7 @@ DLL_API extern const int Null; ///< SQLITE_NULL * because of the way it shares the underling SQLite precompiled statement * in a custom shared pointer (See the inner class "Statement::Ptr"). */ -class DLL_API Column +class SQLITECPP_API Column { public: /** @@ -242,7 +242,7 @@ private: * * @return Reference to the stream used */ -DLL_API std::ostream& operator<<(std::ostream& aStream, const Column& aColumn); +SQLITECPP_API std::ostream& operator<<(std::ostream& aStream, const Column& aColumn); #if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900) // c++14: Visual Studio 2015 diff --git a/include/SQLiteCpp/Database.h b/include/SQLiteCpp/Database.h index 7d34988..d0de0b4 100644 --- a/include/SQLiteCpp/Database.h +++ b/include/SQLiteCpp/Database.h @@ -85,37 +85,37 @@ namespace SQLite // Those public constants enable most usages of SQLiteCpp without including in the client application. /// The database is opened in read-only mode. If the database does not already exist, an error is returned. -DLL_API extern const int OPEN_READONLY; // SQLITE_OPEN_READONLY +SQLITECPP_API extern const int OPEN_READONLY; // SQLITE_OPEN_READONLY /// The database is opened for reading and writing if possible, or reading only if the file is write protected /// by the operating system. In either case the database must already exist, otherwise an error is returned. -DLL_API extern const int OPEN_READWRITE; // SQLITE_OPEN_READWRITE +SQLITECPP_API extern const int OPEN_READWRITE; // SQLITE_OPEN_READWRITE /// With OPEN_READWRITE: The database is opened for reading and writing, and is created if it does not already exist. -DLL_API extern const int OPEN_CREATE; // SQLITE_OPEN_CREATE +SQLITECPP_API extern const int OPEN_CREATE; // SQLITE_OPEN_CREATE /// Enable URI filename interpretation, parsed according to RFC 3986 (ex. "file:data.db?mode=ro&cache=private") -DLL_API extern const int OPEN_URI; // SQLITE_OPEN_URI +SQLITECPP_API extern const int OPEN_URI; // SQLITE_OPEN_URI /// Open in memory database -DLL_API extern const int OPEN_MEMORY; // SQLITE_OPEN_MEMORY +SQLITECPP_API extern const int OPEN_MEMORY; // SQLITE_OPEN_MEMORY /// Open database in multi-thread threading mode -DLL_API extern const int OPEN_NOMUTEX; // SQLITE_OPEN_NOMUTEX +SQLITECPP_API extern const int OPEN_NOMUTEX; // SQLITE_OPEN_NOMUTEX /// Open database with thread-safety in serialized threading mode -DLL_API extern const int OPEN_FULLMUTEX; // SQLITE_OPEN_FULLMUTEX +SQLITECPP_API extern const int OPEN_FULLMUTEX; // SQLITE_OPEN_FULLMUTEX /// Open database with shared cache enabled -DLL_API extern const int OPEN_SHAREDCACHE; // SQLITE_OPEN_SHAREDCACHE +SQLITECPP_API extern const int OPEN_SHAREDCACHE; // SQLITE_OPEN_SHAREDCACHE /// Open database with shared cache disabled -DLL_API extern const int OPEN_PRIVATECACHE; // SQLITE_OPEN_PRIVATECACHE +SQLITECPP_API extern const int OPEN_PRIVATECACHE; // SQLITE_OPEN_PRIVATECACHE /// Database filename is not allowed to be a symbolic link (Note: only since SQlite 3.31.0 from 2020-01-22) -DLL_API extern const int OPEN_NOFOLLOW; // SQLITE_OPEN_NOFOLLOW +SQLITECPP_API extern const int OPEN_NOFOLLOW; // SQLITE_OPEN_NOFOLLOW -DLL_API extern const int OK; ///< SQLITE_OK (used by check() bellow) +SQLITECPP_API extern const int OK; ///< SQLITE_OK (used by check() bellow) -DLL_API extern const char* const VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time -DLL_API extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time +SQLITECPP_API extern const char* const VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time +SQLITECPP_API extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time /// Return SQLite version string using runtime call to the compiled library -DLL_API const char* getLibVersion() noexcept; +SQLITECPP_API const char* getLibVersion() noexcept; /// Return SQLite version number using runtime call to the compiled library -DLL_API int getLibVersionNumber() noexcept; +SQLITECPP_API int getLibVersionNumber() noexcept; // Public structure for representing all fields contained within the SQLite header. // Official documentation for fields: https://www.sqlite.org/fileformat.html#the_database_header @@ -161,7 +161,7 @@ struct Header { * because of the way it shares the underling SQLite precompiled statement * in a custom shared pointer (See the inner class "Statement::Ptr"). */ -class DLL_API Database +class SQLITECPP_API Database { friend class Statement; // Give Statement constructor access to the mSQLitePtr Connection Handle @@ -266,7 +266,7 @@ public: // Deleter functor to use with smart pointers to close the SQLite database connection in an RAII fashion. struct Deleter { - DLL_API void operator()(sqlite3* apSQLite); + SQLITECPP_API void operator()(sqlite3* apSQLite); }; /** diff --git a/include/SQLiteCpp/Exception.h b/include/SQLiteCpp/Exception.h index e771dce..cb7c665 100644 --- a/include/SQLiteCpp/Exception.h +++ b/include/SQLiteCpp/Exception.h @@ -24,7 +24,7 @@ namespace SQLite /** * @brief Encapsulation of the error message from SQLite3, based on std::runtime_error. */ -class DLL_API Exception : public std::runtime_error +class SQLITECPP_API Exception : public std::runtime_error { public: /** diff --git a/include/SQLiteCpp/SQLiteCppExport.h b/include/SQLiteCpp/SQLiteCppExport.h index dea371a..8f76f0f 100644 --- a/include/SQLiteCpp/SQLiteCppExport.h +++ b/include/SQLiteCpp/SQLiteCppExport.h @@ -20,14 +20,18 @@ /* Windows DLL export/import */ #if defined(_WIN32) && defined(SQLITECPP_COMPILE_DLL) #if SQLITECPP_DLL_EXPORT - #define DLL_API __declspec(dllexport) + #define SQLITECPP_API __declspec(dllexport) #pragma message("Exporting symbols") #else - #define DLL_API __declspec(dllimport) + #define SQLITECPP_API __declspec(dllimport) #pragma message("Importing symbols") #endif #else - #define DLL_API + #if __GNUC__ >= 4 + #define SQLITECPP_API __attribute__ ((visibility ("default"))) + #else + #define SQLITECPP_API + #endif #endif #if defined(WIN32) && defined(SQLITECPP_COMPILE_DLL) diff --git a/include/SQLiteCpp/Savepoint.h b/include/SQLiteCpp/Savepoint.h index 8a5d845..febe046 100644 --- a/include/SQLiteCpp/Savepoint.h +++ b/include/SQLiteCpp/Savepoint.h @@ -54,7 +54,7 @@ class Database; * because of the way it shares the underling SQLite precompiled statement * in a custom shared pointer (See the inner class "Statement::Ptr"). */ -class DLL_API Savepoint +class SQLITECPP_API Savepoint { public: /** diff --git a/include/SQLiteCpp/Statement.h b/include/SQLiteCpp/Statement.h index bddc369..f33e18a 100644 --- a/include/SQLiteCpp/Statement.h +++ b/include/SQLiteCpp/Statement.h @@ -31,7 +31,7 @@ namespace SQLite class Database; class Column; -DLL_API extern const int OK; ///< SQLITE_OK +SQLITECPP_API extern const int OK; ///< SQLITE_OK /** * @brief RAII encapsulation of a prepared SQLite Statement. @@ -50,7 +50,7 @@ DLL_API extern const int OK; ///< SQLITE_OK * because of the way it shares the underling SQLite precompiled statement * in a custom shared pointer (See the inner class "Statement::Ptr"). */ -class DLL_API Statement +class SQLITECPP_API Statement { public: /** diff --git a/include/SQLiteCpp/Transaction.h b/include/SQLiteCpp/Transaction.h index 77a3235..5cc4171 100644 --- a/include/SQLiteCpp/Transaction.h +++ b/include/SQLiteCpp/Transaction.h @@ -51,7 +51,7 @@ enum class TransactionBehavior { * because of the way it shares the underling SQLite precompiled statement * in a custom shared pointer (See the inner class "Statement::Ptr"). */ -class DLL_API Transaction +class SQLITECPP_API Transaction { public: /** diff --git a/src/Column.cpp b/src/Column.cpp index ec7c64d..74b288d 100644 --- a/src/Column.cpp +++ b/src/Column.cpp @@ -18,11 +18,11 @@ namespace SQLite { -DLL_API const int INTEGER = SQLITE_INTEGER; -DLL_API const int FLOAT = SQLITE_FLOAT; -DLL_API const int TEXT = SQLITE_TEXT; -DLL_API const int BLOB = SQLITE_BLOB; -DLL_API const int Null = SQLITE_NULL; +SQLITECPP_API const int INTEGER = SQLITE_INTEGER; +SQLITECPP_API const int FLOAT = SQLITE_FLOAT; +SQLITECPP_API const int TEXT = SQLITE_TEXT; +SQLITECPP_API const int BLOB = SQLITE_BLOB; +SQLITECPP_API const int Null = SQLITE_NULL; // Encapsulation of a Column in a row of the result pointed by the prepared Statement. diff --git a/src/Database.cpp b/src/Database.cpp index a473dd9..c982dd5 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -26,25 +26,25 @@ namespace SQLite { -DLL_API const int OK = SQLITE_OK; -DLL_API const int OPEN_READONLY = SQLITE_OPEN_READONLY; -DLL_API const int OPEN_READWRITE = SQLITE_OPEN_READWRITE; -DLL_API const int OPEN_CREATE = SQLITE_OPEN_CREATE; -DLL_API const int OPEN_URI = SQLITE_OPEN_URI; -DLL_API const int OPEN_MEMORY = SQLITE_OPEN_MEMORY; -DLL_API const int OPEN_NOMUTEX = SQLITE_OPEN_NOMUTEX; -DLL_API const int OPEN_FULLMUTEX = SQLITE_OPEN_FULLMUTEX; -DLL_API const int OPEN_SHAREDCACHE = SQLITE_OPEN_SHAREDCACHE; -DLL_API const int OPEN_PRIVATECACHE = SQLITE_OPEN_PRIVATECACHE; +SQLITECPP_API const int OK = SQLITE_OK; +SQLITECPP_API const int OPEN_READONLY = SQLITE_OPEN_READONLY; +SQLITECPP_API const int OPEN_READWRITE = SQLITE_OPEN_READWRITE; +SQLITECPP_API const int OPEN_CREATE = SQLITE_OPEN_CREATE; +SQLITECPP_API const int OPEN_URI = SQLITE_OPEN_URI; +SQLITECPP_API const int OPEN_MEMORY = SQLITE_OPEN_MEMORY; +SQLITECPP_API const int OPEN_NOMUTEX = SQLITE_OPEN_NOMUTEX; +SQLITECPP_API const int OPEN_FULLMUTEX = SQLITE_OPEN_FULLMUTEX; +SQLITECPP_API const int OPEN_SHAREDCACHE = SQLITE_OPEN_SHAREDCACHE; +SQLITECPP_API const int OPEN_PRIVATECACHE = SQLITE_OPEN_PRIVATECACHE; // check if sqlite version is >= 3.31.0 and SQLITE_OPEN_NOFOLLOW is defined #if SQLITE_VERSION_NUMBER >= 3031000 && defined(SQLITE_OPEN_NOFOLLOW) -DLL_API const int OPEN_NOFOLLOW = SQLITE_OPEN_NOFOLLOW; +SQLITECPP_API const int OPEN_NOFOLLOW = SQLITE_OPEN_NOFOLLOW; #else -DLL_API const int OPEN_NOFOLLOW = 0; +SQLITECPP_API const int OPEN_NOFOLLOW = 0; #endif -DLL_API const char* const VERSION = SQLITE_VERSION; -DLL_API const int VERSION_NUMBER = SQLITE_VERSION_NUMBER; +SQLITECPP_API const char* const VERSION = SQLITE_VERSION; +SQLITECPP_API const int VERSION_NUMBER = SQLITE_VERSION_NUMBER; // Return SQLite version string using runtime call to the compiled library const char* getLibVersion() noexcept