diff options
author | cmumford <cmumford@google.com> | 2017-10-04 11:26:45 -0700 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2017-10-04 11:53:12 -0700 |
commit | 4a7e7f50dcf661cfffe71737650b0fb18e195d18 (patch) | |
tree | 613570bad946d1e0ac86fb86e0d12e97988527a8 /include/leveldb/db.h | |
parent | 542590d2a8eee3838f40b01405baa6d2f6f8c700 (diff) | |
download | leveldb-4a7e7f50dcf661cfffe71737650b0fb18e195d18.tar.gz |
Add LEVELDB_EXPORT macro to export public symbols.
gcc defaults to exporting all symbols, but other linkers do not. Adding
the LEVELDB_EXPORT macro allows a project to set LEVELDB_SHARED_LIBRARY
when building/linking with leveldb as a shared library.
This is to allow leveldb to be created as a shared library on all
platforms support by Chrome and enables a fix for
https://bugs.chromium.org/p/chromium/issues/detail?id=764810.
This also has the benefit of reducing the shared library size from
418863 to 380367 bytes (64-bit Linux).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171037148
Diffstat (limited to 'include/leveldb/db.h')
-rw-r--r-- | include/leveldb/db.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/leveldb/db.h b/include/leveldb/db.h index bfab10a..9a18c92 100644 --- a/include/leveldb/db.h +++ b/include/leveldb/db.h @@ -7,6 +7,7 @@ #include <stdint.h> #include <stdio.h> +#include "leveldb/export.h" #include "leveldb/iterator.h" #include "leveldb/options.h" @@ -24,13 +25,13 @@ class WriteBatch; // Abstract handle to particular state of a DB. // A Snapshot is an immutable object and can therefore be safely // accessed from multiple threads without any external synchronization. -class Snapshot { +class LEVELDB_EXPORT Snapshot { protected: virtual ~Snapshot(); }; // A range of keys -struct Range { +struct LEVELDB_EXPORT Range { Slice start; // Included in the range Slice limit; // Not included in the range @@ -41,7 +42,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 +151,15 @@ 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 |