From bfe0d519b9e28305288ba906c14b8f87294eb85f Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Fri, 22 Sep 2017 17:56:37 -0700 Subject: WiP: Dynamic library support. --- helpers/memenv/memenv.h | 4 +++- include/leveldb/comparator.h | 4 +++- include/leveldb/db.h | 8 +++++--- include/leveldb/env.h | 14 +++++++------- include/leveldb/filter_policy.h | 4 +++- include/leveldb/iterator.h | 4 +++- include/leveldb/status.h | 4 +++- include/leveldb/write_batch.h | 4 +++- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/helpers/memenv/memenv.h b/helpers/memenv/memenv.h index 03b88de..17aa1db 100644 --- a/helpers/memenv/memenv.h +++ b/helpers/memenv/memenv.h @@ -5,6 +5,8 @@ #ifndef STORAGE_LEVELDB_HELPERS_MEMENV_MEMENV_H_ #define STORAGE_LEVELDB_HELPERS_MEMENV_MEMENV_H_ +#include "../../../leveldb_exports.h" + namespace leveldb { class Env; @@ -13,7 +15,7 @@ class Env; // all non-file-storage tasks to base_env. The caller must delete the result // when it is no longer needed. // *base_env must remain live while the result is in use. -Env* NewMemEnv(Env* base_env); +LEVELDB_EXPORT Env* NewMemEnv(Env* base_env); } // namespace leveldb diff --git a/include/leveldb/comparator.h b/include/leveldb/comparator.h index 556b984..3d691c6 100644 --- a/include/leveldb/comparator.h +++ b/include/leveldb/comparator.h @@ -7,6 +7,8 @@ #include +#include "../../../leveldb_exports.h" + namespace leveldb { class Slice; @@ -15,7 +17,7 @@ class Slice; // used as keys in an sstable or a database. A Comparator implementation // must be thread-safe since leveldb may invoke its methods concurrently // from multiple threads. -class Comparator { +class LEVELDB_EXPORT Comparator { public: virtual ~Comparator(); diff --git a/include/leveldb/db.h b/include/leveldb/db.h index bfab10a..11492e4 100644 --- a/include/leveldb/db.h +++ b/include/leveldb/db.h @@ -10,6 +10,8 @@ #include "leveldb/iterator.h" #include "leveldb/options.h" +#include "../../../leveldb_exports.h" + namespace leveldb { // Update Makefile if you change these @@ -41,7 +43,7 @@ struct Range { // A DB is a persistent ordered map from keys to values. // A DB is safe for concurrent access from multiple threads without // any external synchronization. -class DB { +class LEVELDB_EXPORT DB { public: // Open the database with the specified "name". // Stores a pointer to a heap-allocated database in *dbptr and returns @@ -150,13 +152,13 @@ class DB { // Destroy the contents of the specified database. // Be very careful using this method. -Status DestroyDB(const std::string& name, const Options& options); +LEVELDB_EXPORT Status DestroyDB(const std::string& name, const Options& options); // If a DB cannot be opened, you may attempt to call this method to // resurrect as much of the contents of the database as possible. // Some data may be lost, so be careful when calling this function // on a database that contains important information. -Status RepairDB(const std::string& dbname, const Options& options); +LEVELDB_EXPORT Status RepairDB(const std::string& dbname, const Options& options); } // namespace leveldb diff --git a/include/leveldb/env.h b/include/leveldb/env.h index cb8b6a4..c33696f 100644 --- a/include/leveldb/env.h +++ b/include/leveldb/env.h @@ -28,7 +28,7 @@ class SequentialFile; class Slice; class WritableFile; -class Env { +class LEVELDB_EXPORT Env { public: Env() { } virtual ~Env(); @@ -169,7 +169,7 @@ class Env { }; // A file abstraction for reading sequentially through a file -class SequentialFile { +class LEVELDB_EXPORT SequentialFile { public: SequentialFile() { } virtual ~SequentialFile(); @@ -200,7 +200,7 @@ class SequentialFile { }; // A file abstraction for randomly reading the contents of a file. -class RandomAccessFile { +class LEVELDB_EXPORT RandomAccessFile { public: RandomAccessFile() { } virtual ~RandomAccessFile(); @@ -226,7 +226,7 @@ class RandomAccessFile { // A file abstraction for sequential writing. The implementation // must provide buffering since callers may append small fragments // at a time to the file. -class WritableFile { +class LEVELDB_EXPORT WritableFile { public: WritableFile() { } virtual ~WritableFile(); @@ -243,7 +243,7 @@ class WritableFile { }; // An interface for writing log messages. -class Logger { +class LEVELDB_EXPORT Logger { public: Logger() { } virtual ~Logger(); @@ -259,7 +259,7 @@ class Logger { // Identifies a locked file. -class FileLock { +class LEVELDB_EXPORT FileLock { public: FileLock() { } virtual ~FileLock(); @@ -287,7 +287,7 @@ extern Status ReadFileToString(Env* env, const std::string& fname, // An implementation of Env that forwards all calls to another Env. // May be useful to clients who wish to override just part of the // functionality of another Env. -class EnvWrapper : public Env { +class LEVELDB_EXPORT EnvWrapper : public Env { public: // Initialize an EnvWrapper that delegates all calls to *t explicit EnvWrapper(Env* t) : target_(t) { } diff --git a/include/leveldb/filter_policy.h b/include/leveldb/filter_policy.h index 1fba080..9833cf8 100644 --- a/include/leveldb/filter_policy.h +++ b/include/leveldb/filter_policy.h @@ -18,6 +18,8 @@ #include +#include "../../../leveldb_exports.h" + namespace leveldb { class Slice; @@ -63,7 +65,7 @@ class FilterPolicy { // ignores trailing spaces, it would be incorrect to use a // FilterPolicy (like NewBloomFilterPolicy) that does not ignore // trailing spaces in keys. -extern const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); +LEVELDB_EXPORT extern const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); } diff --git a/include/leveldb/iterator.h b/include/leveldb/iterator.h index da631ed..ce22ee5 100644 --- a/include/leveldb/iterator.h +++ b/include/leveldb/iterator.h @@ -18,9 +18,11 @@ #include "leveldb/slice.h" #include "leveldb/status.h" +#include "../../../leveldb_exports.h" + namespace leveldb { -class Iterator { +class LEVELDB_EXPORT Iterator { public: Iterator(); virtual ~Iterator(); diff --git a/include/leveldb/status.h b/include/leveldb/status.h index d9575f9..ebea94f 100644 --- a/include/leveldb/status.h +++ b/include/leveldb/status.h @@ -16,9 +16,11 @@ #include #include "leveldb/slice.h" +#include "../../../leveldb_exports.h" + namespace leveldb { -class Status { +class LEVELDB_EXPORT Status { public: // Create a success status. Status() : state_(NULL) { } diff --git a/include/leveldb/write_batch.h b/include/leveldb/write_batch.h index 65a76d8..0c65717 100644 --- a/include/leveldb/write_batch.h +++ b/include/leveldb/write_batch.h @@ -24,11 +24,13 @@ #include #include "leveldb/status.h" +#include "../../../leveldb_exports.h" + namespace leveldb { class Slice; -class WriteBatch { +class LEVELDB_EXPORT WriteBatch { public: WriteBatch(); ~WriteBatch(); -- cgit v1.2.1