Skip to content

Commit 1733d01

Browse files
committed
kernel: Hack to expose the current api
1 parent 3d4efae commit 1733d01

23 files changed

+89
-36
lines changed

src/chain.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <consensus/params.h>
1111
#include <flatfile.h>
1212
#include <kernel/cs_main.h>
13+
#include <kernel/bitcoinkernel.h>
1314
#include <primitives/block.h>
1415
#include <sync.h>
1516
#include <uint256.h>
@@ -147,7 +148,7 @@ enum BlockStatus : uint32_t {
147148
* candidates to be the next block. A blockindex may have multiple pprev pointing
148149
* to it, but at most one of them can be part of the currently active branch.
149150
*/
150-
class CBlockIndex
151+
class EXPORT_SYMBOL CBlockIndex
151152
{
152153
public:
153154
//! pointer to the hash of the block, if any. Memory is owned by this CBlockIndex

src/chainparams.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <chainparamsbase.h>
1010
#include <consensus/params.h>
11+
#include <kernel/bitcoinkernel.h>
1112
#include <netaddress.h>
1213
#include <primitives/block.h>
1314
#include <protocol.h>
@@ -157,12 +158,12 @@ std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, c
157158
* Return the currently selected parameters. This won't change after app
158159
* startup, except for unit tests.
159160
*/
160-
const CChainParams &Params();
161+
EXPORT_SYMBOL const CChainParams &Params();
161162

162163
/**
163164
* Sets the params returned by Params() to those for the given chain name.
164165
* @throws std::runtime_error when the chain is not supported.
165166
*/
166-
void SelectParams(const std::string& chain);
167+
EXPORT_SYMBOL void SelectParams(const std::string& chain);
167168

168169
#endif // BITCOIN_CHAINPARAMS_H

src/chainparamsbase.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef BITCOIN_CHAINPARAMSBASE_H
66
#define BITCOIN_CHAINPARAMSBASE_H
77

8+
#include <kernel/bitcoinkernel.h>
9+
810
#include <memory>
911
#include <string>
1012

@@ -14,7 +16,7 @@ class ArgsManager;
1416
* CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
1517
* of a given instance of the Bitcoin system.
1618
*/
17-
class CBaseChainParams
19+
class EXPORT_SYMBOL CBaseChainParams
1820
{
1921
public:
2022
///@{

src/coins.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <compressor.h>
1010
#include <core_memusage.h>
11+
#include <kernel/bitcoinkernel.h>
1112
#include <memusage.h>
1213
#include <primitives/transaction.h>
1314
#include <serialize.h>
@@ -355,7 +356,7 @@ const Coin& AccessByTxid(const CCoinsViewCache& cache, const uint256& txid);
355356
*
356357
* Writes do not need similar protection, as failure to write is handled by the caller.
357358
*/
358-
class CCoinsViewErrorCatcher final : public CCoinsViewBacked
359+
class EXPORT_SYMBOL CCoinsViewErrorCatcher final : public CCoinsViewBacked
359360
{
360361
public:
361362
explicit CCoinsViewErrorCatcher(CCoinsView* view) : CCoinsViewBacked(view) {}

src/core_io.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define BITCOIN_CORE_IO_H
77

88
#include <consensus/amount.h>
9+
#include <kernel/bitcoinkernel.h>
910

1011
#include <string>
1112
#include <vector>
@@ -33,7 +34,7 @@ enum class TxVerbosity {
3334
CScript ParseScript(const std::string& s);
3435
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
3536
[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
36-
[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
37+
EXPORT_SYMBOL [[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
3738
bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
3839

3940
/**

src/dbwrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <clientversion.h>
99
#include <fs.h>
10+
#include <kernel/bitcoinkernel.h>
1011
#include <logging.h>
1112
#include <serialize.h>
1213
#include <span.h>
@@ -207,7 +208,7 @@ class CDBIterator
207208
}
208209
};
209210

210-
class CDBWrapper
211+
class EXPORT_SYMBOL CDBWrapper
211212
{
212213
friend const std::vector<unsigned char>& dbwrapper_private::GetObfuscateKey(const CDBWrapper &w);
213214
private:

src/kernel/bitcoinkernel.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef KERNEL_BITCOINKERNEL_H
6+
#define KERNEL_BITCOINKERNEL_H
7+
8+
#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
9+
#include <config/bitcoin-config.h>
10+
#if defined(_WIN32)
11+
#if defined(HAVE_DLLEXPORT_ATTRIBUTE)
12+
#define EXPORT_SYMBOL __declspec(dllexport)
13+
#else
14+
#define EXPORT_SYMBOL
15+
#endif
16+
#elif defined(HAVE_DEFAULT_VISIBILITY_ATTRIBUTE)
17+
#define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
18+
#endif
19+
#elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINKERNEL)
20+
#define EXPORT_SYMBOL __declspec(dllimport)
21+
#endif
22+
23+
#ifndef EXPORT_SYMBOL
24+
#define EXPORT_SYMBOL
25+
#endif
26+
27+
#endif // BITCOIN_BITCOINKERNEL_H

src/kernel/checks.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef BITCOIN_KERNEL_CHECKS_H
66
#define BITCOIN_KERNEL_CHECKS_H
77

8+
#include <kernel/bitcoinkernel.h>
9+
810
#include <optional>
911

1012
struct bilingual_str;
@@ -16,7 +18,7 @@ struct Context;
1618
/**
1719
* Ensure a usable environment with all necessary library support.
1820
*/
19-
std::optional<bilingual_str> SanityChecks(const Context&);
21+
EXPORT_SYMBOL std::optional<bilingual_str> SanityChecks(const Context&);
2022

2123
}
2224

src/kernel/context.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef BITCOIN_KERNEL_CONTEXT_H
66
#define BITCOIN_KERNEL_CONTEXT_H
77

8+
#include <kernel/bitcoinkernel.h>
9+
810
#include <memory>
911

1012
namespace kernel {
@@ -15,7 +17,7 @@ namespace kernel {
1517
//!
1618
//! State stored directly in this struct should be simple. More complex state
1719
//! should be stored to std::unique_ptr members pointing to opaque types.
18-
struct Context {
20+
struct EXPORT_SYMBOL Context {
1921
//! Declare default constructor and destructor that are not inline, so code
2022
//! instantiating the kernel::Context struct doesn't need to #include class
2123
//! definitions for all the unique_ptr members.

src/kernel/cs_main.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef BITCOIN_KERNEL_CS_MAIN_H
66
#define BITCOIN_KERNEL_CS_MAIN_H
77

8+
#include <kernel/bitcoinkernel.h>
89
#include <sync.h>
910

1011
/**
@@ -17,6 +18,6 @@
1718
* The transaction pool has a separate lock to allow reading from it and the
1819
* chainstate at the same time.
1920
*/
20-
extern RecursiveMutex cs_main;
21+
EXPORT_SYMBOL extern RecursiveMutex cs_main;
2122

2223
#endif // BITCOIN_KERNEL_CS_MAIN_H

0 commit comments

Comments
 (0)