Skip to content

Commit cd8e053

Browse files
Export internal symbols for shared library builds (#1283)
These symbols are internal to FTXUI (located in src/), but they must be exported when building as shared libraries because of internal dependencies between the screen, dom, and component libraries. - SCREEN symbols in string_internal.hpp are used by COMPONENT. - DOM symbols in node_decorator.hpp are used by COMPONENT. Other internal symbols used only by tests were reverted to keep the shared library API minimal. Note that internal unit tests may fail to link in shared library mode as a result.
1 parent 5b0046f commit cd8e053

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/ftxui/dom/node_decorator.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
#include "ftxui/dom/elements.hpp" // for Element, unpack
1010
#include "ftxui/dom/node.hpp" // for Node
11+
#include "ftxui/util/export.hpp" // for FTXUI_EXPORT
1112

1213
namespace ftxui {
1314
struct Box;
1415

1516
// Helper class.
16-
class NodeDecorator : public Node {
17+
// Internal class exported for the 'component' library.
18+
class FTXUI_EXPORT(DOM) NodeDecorator : public Node {
1719
public:
1820
explicit NodeDecorator(Element child) : Node(unpack(std::move(child))) {}
1921
void ComputeRequirement() override;

src/ftxui/screen/string_internal.hpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@
88
#include <string>
99
#include <vector>
1010

11+
#include "ftxui/util/export.hpp"
12+
1113
namespace ftxui {
1214

15+
// Internal functions exported for the 'component' library.
16+
FTXUI_EXPORT(SCREEN)
1317
bool EatCodePoint(std::string_view input,
1418
size_t start,
1519
size_t* end,
1620
uint32_t* ucs);
21+
FTXUI_EXPORT(SCREEN)
1722
bool EatCodePoint(std::wstring_view input,
1823
size_t start,
1924
size_t* end,
2025
uint32_t* ucs);
2126

22-
bool IsCombining(uint32_t ucs);
23-
bool IsFullWidth(uint32_t ucs);
24-
bool IsControl(uint32_t ucs);
27+
FTXUI_EXPORT(SCREEN) bool IsCombining(uint32_t ucs);
28+
FTXUI_EXPORT(SCREEN) bool IsFullWidth(uint32_t ucs);
29+
FTXUI_EXPORT(SCREEN) bool IsControl(uint32_t ucs);
2530

26-
size_t GlyphPrevious(std::string_view input, size_t start);
27-
size_t GlyphNext(std::string_view input, size_t start);
31+
FTXUI_EXPORT(SCREEN) size_t GlyphPrevious(std::string_view input, size_t start);
32+
FTXUI_EXPORT(SCREEN) size_t GlyphNext(std::string_view input, size_t start);
2833

2934
// Return the index in the |input| string of the glyph at |glyph_offset|,
3035
// starting at |start|
36+
FTXUI_EXPORT(SCREEN)
3137
size_t GlyphIterate(std::string_view input, int glyph_offset, size_t start = 0);
3238

3339
// Returns the number of glyphs in |input|.
34-
int GlyphCount(std::string_view input);
40+
FTXUI_EXPORT(SCREEN) int GlyphCount(std::string_view input);
3541

3642
// Properties from:
3743
// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
@@ -55,9 +61,12 @@ enum class WordBreakProperty : int8_t {
5561
WSegSpace,
5662
ZWJ,
5763
};
64+
FTXUI_EXPORT(SCREEN)
5865
WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
66+
FTXUI_EXPORT(SCREEN)
5967
std::vector<WordBreakProperty> Utf8ToWordBreakProperty(std::string_view input);
6068

69+
FTXUI_EXPORT(SCREEN)
6170
bool IsWordBreakingCharacter(std::string_view input, size_t glyph_index);
6271
} // namespace ftxui
6372

0 commit comments

Comments
 (0)