mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-07 19:26:10 -04:00
Add dll export/import macros
This commit is contained in:
parent
bac9a8a6ad
commit
25ab3ce1c2
@ -17,6 +17,11 @@ endif ()
|
||||
message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_definitions(-DSQLITECPP_COMPILE_DLL -DSQLITECPP_EXPORT)
|
||||
endif()
|
||||
|
||||
message (STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
message (STATUS "Project version: ${PROJECT_VERSION}")
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Database.h>
|
||||
|
||||
#include <string>
|
||||
@ -31,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 Backup
|
||||
class DLL_API Backup
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Statement.h>
|
||||
#include <SQLiteCpp/Exception.h>
|
||||
|
||||
@ -22,11 +23,11 @@ struct sqlite3_stmt;
|
||||
namespace SQLite
|
||||
{
|
||||
|
||||
extern const int INTEGER; ///< SQLITE_INTEGER
|
||||
extern const int FLOAT; ///< SQLITE_FLOAT
|
||||
extern const int TEXT; ///< SQLITE_TEXT
|
||||
extern const int BLOB; ///< SQLITE_BLOB
|
||||
extern const int Null; ///< SQLITE_NULL
|
||||
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
|
||||
|
||||
/**
|
||||
* @brief Encapsulation of a Column in a row of the result pointed by the prepared Statement.
|
||||
@ -44,7 +45,7 @@ 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 Column
|
||||
class DLL_API Column
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@ -241,7 +242,7 @@ private:
|
||||
*
|
||||
* @return Reference to the stream used
|
||||
*/
|
||||
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
|
||||
DLL_API std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
|
||||
|
||||
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900) // c++14: Visual Studio 2015
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Column.h>
|
||||
|
||||
// c++17: MinGW GCC version > 8
|
||||
@ -84,26 +85,26 @@ namespace SQLite
|
||||
// Those public constants enable most usages of SQLiteCpp without including <sqlite3.h> in the client application.
|
||||
|
||||
/// The database is opened in read-only mode. If the database does not already exist, an error is returned.
|
||||
extern const int OPEN_READONLY; // SQLITE_OPEN_READONLY
|
||||
DLL_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.
|
||||
extern const int OPEN_READWRITE; // SQLITE_OPEN_READWRITE
|
||||
DLL_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.
|
||||
extern const int OPEN_CREATE; // SQLITE_OPEN_CREATE
|
||||
DLL_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")
|
||||
extern const int OPEN_URI; // SQLITE_OPEN_URI
|
||||
DLL_API extern const int OPEN_URI; // SQLITE_OPEN_URI
|
||||
/// Open in memory database
|
||||
extern const int OPEN_MEMORY; // SQLITE_OPEN_MEMORY
|
||||
DLL_API extern const int OPEN_MEMORY; // SQLITE_OPEN_MEMORY
|
||||
/// Open database in multi-thread threading mode
|
||||
extern const int OPEN_NOMUTEX; // SQLITE_OPEN_NOMUTEX
|
||||
DLL_API extern const int OPEN_NOMUTEX; // SQLITE_OPEN_NOMUTEX
|
||||
/// Open database with thread-safety in serialized threading mode
|
||||
extern const int OPEN_FULLMUTEX; // SQLITE_OPEN_FULLMUTEX
|
||||
DLL_API extern const int OPEN_FULLMUTEX; // SQLITE_OPEN_FULLMUTEX
|
||||
/// Open database with shared cache enabled
|
||||
extern const int OPEN_SHAREDCACHE; // SQLITE_OPEN_SHAREDCACHE
|
||||
DLL_API extern const int OPEN_SHAREDCACHE; // SQLITE_OPEN_SHAREDCACHE
|
||||
/// Open database with shared cache disabled
|
||||
extern const int OPEN_PRIVATECACHE; // SQLITE_OPEN_PRIVATECACHE
|
||||
DLL_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)
|
||||
extern const int OPEN_NOFOLLOW; // SQLITE_OPEN_NOFOLLOW
|
||||
DLL_API extern const int OPEN_NOFOLLOW; // SQLITE_OPEN_NOFOLLOW
|
||||
|
||||
|
||||
extern const int OK; ///< SQLITE_OK (used by check() bellow)
|
||||
@ -160,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 Database
|
||||
class DLL_API Database
|
||||
{
|
||||
friend class Statement; // Give Statement constructor access to the mSQLitePtr Connection Handle
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@ -23,7 +24,7 @@ namespace SQLite
|
||||
/**
|
||||
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||
*/
|
||||
class Exception : public std::runtime_error
|
||||
class DLL_API Exception : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
|
||||
// Include useful headers of SQLiteC++
|
||||
#include <SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Assertion.h>
|
||||
#include <SQLiteCpp/Exception.h>
|
||||
#include <SQLiteCpp/Database.h>
|
||||
@ -42,3 +43,5 @@
|
||||
*/
|
||||
#define SQLITECPP_VERSION "3.02.01" // 3.2.1
|
||||
#define SQLITECPP_VERSION_NUMBER 3002001 // 3.2.1
|
||||
|
||||
|
||||
|
29
include/SQLiteCpp/SQLiteCppExport.h
Normal file
29
include/SQLiteCpp/SQLiteCppExport.h
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @file SQLiteCppExport.h
|
||||
* @ingroup SQLiteCpp
|
||||
* @brief File with macros needed in the generation of Windows DLLs
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2012-2022 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* #define SQLITECPP_COMPILE_DLL to compile a DLL under Windows
|
||||
* #define SQLITECPP_EXPORT to export symbols when creating the DLL, otherwise it defaults to importing symbols
|
||||
*/
|
||||
|
||||
/* Windows DLL export/import */
|
||||
#if defined(WIN32) && defined(SQLITECPP_COMPILE_DLL)
|
||||
#ifdef SQLITECPP_EXPORT
|
||||
#define DLL_API __declspec(dllexport)
|
||||
#pragma message("Exporting symbols")
|
||||
#else
|
||||
#define DLL_API __declspec(dllimport)
|
||||
#pragma message("Importing symbols")
|
||||
#endif
|
||||
#endif
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Exception.h>
|
||||
|
||||
namespace SQLite
|
||||
@ -53,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 Savepoint
|
||||
class DLL_API Savepoint
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Exception.h>
|
||||
#include <SQLiteCpp/Utils.h> // SQLITECPP_PURE_FUNC
|
||||
|
||||
@ -49,7 +50,7 @@ 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 Statement
|
||||
class DLL_API Statement
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <SQLiteCpp/SQLiteCppExport.h>
|
||||
#include <SQLiteCpp/Exception.h>
|
||||
|
||||
|
||||
@ -50,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 Transaction
|
||||
class DLL_API Transaction
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user