From 0c765c7c585a33abcac67ab9aebb32ab758fe17f Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Mon, 30 Mar 2026 09:16:03 +0200 Subject: [PATCH] libghostty: add GHOSTTY_EXPORT to VT headers Extend GHOSTTY_EXPORT annotations to all public function declarations in include/ghostty/vt/ headers. Add GHOSTTY_EXPORT macro to types.h with ifndef guard so both ghostty.h and VT headers share the same definition without conflict. --- include/ghostty.h | 2 ++ include/ghostty/vt/allocator.h | 5 +++-- include/ghostty/vt/build_info.h | 2 +- include/ghostty/vt/color.h | 3 ++- include/ghostty/vt/focus.h | 2 +- include/ghostty/vt/formatter.h | 8 ++++---- include/ghostty/vt/grid_ref.h | 8 ++++---- include/ghostty/vt/key/encoder.h | 10 +++++----- include/ghostty/vt/key/event.h | 32 +++++++++++++++--------------- include/ghostty/vt/modes.h | 2 +- include/ghostty/vt/mouse/encoder.h | 12 +++++------ include/ghostty/vt/mouse/event.h | 22 ++++++++++---------- include/ghostty/vt/osc.h | 14 ++++++------- include/ghostty/vt/paste.h | 4 ++-- include/ghostty/vt/render.h | 32 +++++++++++++++--------------- include/ghostty/vt/screen.h | 4 ++-- include/ghostty/vt/sgr.h | 22 ++++++++++---------- include/ghostty/vt/size_report.h | 2 +- include/ghostty/vt/style.h | 4 ++-- include/ghostty/vt/terminal.h | 22 ++++++++++---------- include/ghostty/vt/types.h | 22 ++++++++++++++++++++ include/ghostty/vt/wasm.h | 21 ++++++++++---------- 22 files changed, 141 insertions(+), 114 deletions(-) diff --git a/include/ghostty.h b/include/ghostty.h index 8a3554364..059c943f4 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -33,6 +33,7 @@ typedef SSIZE_T ssize_t; // visibility so they remain accessible when the library is built with // -fvisibility=hidden. For static library builds, define GHOSTTY_STATIC // before including this header to make this a no-op. +#ifndef GHOSTTY_EXPORT #if defined(GHOSTTY_STATIC) #define GHOSTTY_EXPORT #elif defined(_WIN32) || defined(_WIN64) @@ -46,6 +47,7 @@ typedef SSIZE_T ssize_t; #else #define GHOSTTY_EXPORT #endif +#endif //------------------------------------------------------------------- // Types diff --git a/include/ghostty/vt/allocator.h b/include/ghostty/vt/allocator.h index ed2d36794..34b47a9c5 100644 --- a/include/ghostty/vt/allocator.h +++ b/include/ghostty/vt/allocator.h @@ -10,6 +10,7 @@ #include #include #include +#include /** @defgroup allocator Memory Management * @@ -222,7 +223,7 @@ typedef struct GhosttyAllocator { * * @ingroup allocator */ -uint8_t* ghostty_alloc(const GhosttyAllocator* allocator, size_t len); +GHOSTTY_EXPORT uint8_t* ghostty_alloc(const GhosttyAllocator* allocator, size_t len); /** * Free memory that was allocated by a libghostty-vt function. @@ -247,7 +248,7 @@ uint8_t* ghostty_alloc(const GhosttyAllocator* allocator, size_t len); * * @ingroup allocator */ -void ghostty_free(const GhosttyAllocator* allocator, uint8_t* ptr, size_t len); +GHOSTTY_EXPORT void ghostty_free(const GhosttyAllocator* allocator, uint8_t* ptr, size_t len); /** @} */ diff --git a/include/ghostty/vt/build_info.h b/include/ghostty/vt/build_info.h index a81a473f7..ad1c35fae 100644 --- a/include/ghostty/vt/build_info.h +++ b/include/ghostty/vt/build_info.h @@ -129,7 +129,7 @@ typedef enum { * * @ingroup build_info */ -GhosttyResult ghostty_build_info(GhosttyBuildInfo data, void *out); +GHOSTTY_EXPORT GhosttyResult ghostty_build_info(GhosttyBuildInfo data, void *out); #ifdef __cplusplus } diff --git a/include/ghostty/vt/color.h b/include/ghostty/vt/color.h index 0d57b8db4..f5556573b 100644 --- a/include/ghostty/vt/color.h +++ b/include/ghostty/vt/color.h @@ -8,6 +8,7 @@ #define GHOSTTY_VT_COLOR_H #include +#include #ifdef __cplusplus extern "C" { @@ -84,7 +85,7 @@ typedef uint8_t GhosttyColorPaletteIndex; * * @ingroup sgr */ -void ghostty_color_rgb_get(GhosttyColorRgb color, +GHOSTTY_EXPORT void ghostty_color_rgb_get(GhosttyColorRgb color, uint8_t* r, uint8_t* g, uint8_t* b); diff --git a/include/ghostty/vt/focus.h b/include/ghostty/vt/focus.h index e29fe6a66..22b33dfc6 100644 --- a/include/ghostty/vt/focus.h +++ b/include/ghostty/vt/focus.h @@ -60,7 +60,7 @@ typedef enum { * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer * is too small */ -GhosttyResult ghostty_focus_encode( +GHOSTTY_EXPORT GhosttyResult ghostty_focus_encode( GhosttyFocusEvent event, char* buf, size_t buf_len, diff --git a/include/ghostty/vt/formatter.h b/include/ghostty/vt/formatter.h index 573917596..e361b34a8 100644 --- a/include/ghostty/vt/formatter.h +++ b/include/ghostty/vt/formatter.h @@ -149,7 +149,7 @@ typedef struct { * * @ingroup formatter */ -GhosttyResult ghostty_formatter_terminal_new( +GHOSTTY_EXPORT GhosttyResult ghostty_formatter_terminal_new( const GhosttyAllocator* allocator, GhosttyFormatter* formatter, GhosttyTerminal terminal, @@ -176,7 +176,7 @@ GhosttyResult ghostty_formatter_terminal_new( * * @ingroup formatter */ -GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatter, +GHOSTTY_EXPORT GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatter, uint8_t* buf, size_t buf_len, size_t* out_written); @@ -199,7 +199,7 @@ GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatter, * * @ingroup formatter */ -GhosttyResult ghostty_formatter_format_alloc(GhosttyFormatter formatter, +GHOSTTY_EXPORT GhosttyResult ghostty_formatter_format_alloc(GhosttyFormatter formatter, const GhosttyAllocator* allocator, uint8_t** out_ptr, size_t* out_len); @@ -214,7 +214,7 @@ GhosttyResult ghostty_formatter_format_alloc(GhosttyFormatter formatter, * * @ingroup formatter */ -void ghostty_formatter_free(GhosttyFormatter formatter); +GHOSTTY_EXPORT void ghostty_formatter_free(GhosttyFormatter formatter); /** @} */ diff --git a/include/ghostty/vt/grid_ref.h b/include/ghostty/vt/grid_ref.h index 29ecda7b5..4e9e7de2e 100644 --- a/include/ghostty/vt/grid_ref.h +++ b/include/ghostty/vt/grid_ref.h @@ -66,7 +66,7 @@ typedef struct { * * @ingroup grid_ref */ -GhosttyResult ghostty_grid_ref_cell(const GhosttyGridRef *ref, +GHOSTTY_EXPORT GhosttyResult ghostty_grid_ref_cell(const GhosttyGridRef *ref, GhosttyCell *out_cell); /** @@ -79,7 +79,7 @@ GhosttyResult ghostty_grid_ref_cell(const GhosttyGridRef *ref, * * @ingroup grid_ref */ -GhosttyResult ghostty_grid_ref_row(const GhosttyGridRef *ref, +GHOSTTY_EXPORT GhosttyResult ghostty_grid_ref_row(const GhosttyGridRef *ref, GhosttyRow *out_row); /** @@ -104,7 +104,7 @@ GhosttyResult ghostty_grid_ref_row(const GhosttyGridRef *ref, * * @ingroup grid_ref */ -GhosttyResult ghostty_grid_ref_graphemes(const GhosttyGridRef *ref, +GHOSTTY_EXPORT GhosttyResult ghostty_grid_ref_graphemes(const GhosttyGridRef *ref, uint32_t *buf, size_t buf_len, size_t *out_len); @@ -119,7 +119,7 @@ GhosttyResult ghostty_grid_ref_graphemes(const GhosttyGridRef *ref, * * @ingroup grid_ref */ -GhosttyResult ghostty_grid_ref_style(const GhosttyGridRef *ref, +GHOSTTY_EXPORT GhosttyResult ghostty_grid_ref_style(const GhosttyGridRef *ref, GhosttyStyle *out_style); /** @} */ diff --git a/include/ghostty/vt/key/encoder.h b/include/ghostty/vt/key/encoder.h index 7351d3f8f..a53a05bd4 100644 --- a/include/ghostty/vt/key/encoder.h +++ b/include/ghostty/vt/key/encoder.h @@ -119,7 +119,7 @@ typedef enum { * * @ingroup key */ -GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder); +GHOSTTY_EXPORT GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder); /** * Free a key encoder instance. @@ -131,7 +131,7 @@ GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, Ghostty * * @ingroup key */ -void ghostty_key_encoder_free(GhosttyKeyEncoder encoder); +GHOSTTY_EXPORT void ghostty_key_encoder_free(GhosttyKeyEncoder encoder); /** * Set an option on the key encoder. @@ -154,7 +154,7 @@ void ghostty_key_encoder_free(GhosttyKeyEncoder encoder); * * @ingroup key */ -void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value); +GHOSTTY_EXPORT void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value); /** * Set encoder options from a terminal's current state. @@ -173,7 +173,7 @@ void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOpti * * @ingroup key */ -void ghostty_key_encoder_setopt_from_terminal(GhosttyKeyEncoder encoder, GhosttyTerminal terminal); +GHOSTTY_EXPORT void ghostty_key_encoder_setopt_from_terminal(GhosttyKeyEncoder encoder, GhosttyTerminal terminal); /** * Encode a key event into a terminal escape sequence. @@ -240,6 +240,6 @@ void ghostty_key_encoder_setopt_from_terminal(GhosttyKeyEncoder encoder, Ghostty * * @ingroup key */ -GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len); +GHOSTTY_EXPORT GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len); #endif /* GHOSTTY_VT_KEY_ENCODER_H */ diff --git a/include/ghostty/vt/key/event.h b/include/ghostty/vt/key/event.h index 18bf4c624..5293f0e43 100644 --- a/include/ghostty/vt/key/event.h +++ b/include/ghostty/vt/key/event.h @@ -310,7 +310,7 @@ typedef enum { * * @ingroup key */ -GhosttyResult ghostty_key_event_new(const GhosttyAllocator *allocator, GhosttyKeyEvent *event); +GHOSTTY_EXPORT GhosttyResult ghostty_key_event_new(const GhosttyAllocator *allocator, GhosttyKeyEvent *event); /** * Free a key event instance. @@ -322,7 +322,7 @@ GhosttyResult ghostty_key_event_new(const GhosttyAllocator *allocator, GhosttyKe * * @ingroup key */ -void ghostty_key_event_free(GhosttyKeyEvent event); +GHOSTTY_EXPORT void ghostty_key_event_free(GhosttyKeyEvent event); /** * Set the key action (press, release, repeat). @@ -332,7 +332,7 @@ void ghostty_key_event_free(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_action(GhosttyKeyEvent event, GhosttyKeyAction action); +GHOSTTY_EXPORT void ghostty_key_event_set_action(GhosttyKeyEvent event, GhosttyKeyAction action); /** * Get the key action (press, release, repeat). @@ -342,7 +342,7 @@ void ghostty_key_event_set_action(GhosttyKeyEvent event, GhosttyKeyAction action * * @ingroup key */ -GhosttyKeyAction ghostty_key_event_get_action(GhosttyKeyEvent event); +GHOSTTY_EXPORT GhosttyKeyAction ghostty_key_event_get_action(GhosttyKeyEvent event); /** * Set the physical key code. @@ -352,7 +352,7 @@ GhosttyKeyAction ghostty_key_event_get_action(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_key(GhosttyKeyEvent event, GhosttyKey key); +GHOSTTY_EXPORT void ghostty_key_event_set_key(GhosttyKeyEvent event, GhosttyKey key); /** * Get the physical key code. @@ -362,7 +362,7 @@ void ghostty_key_event_set_key(GhosttyKeyEvent event, GhosttyKey key); * * @ingroup key */ -GhosttyKey ghostty_key_event_get_key(GhosttyKeyEvent event); +GHOSTTY_EXPORT GhosttyKey ghostty_key_event_get_key(GhosttyKeyEvent event); /** * Set the modifier keys bitmask. @@ -372,7 +372,7 @@ GhosttyKey ghostty_key_event_get_key(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_mods(GhosttyKeyEvent event, GhosttyMods mods); +GHOSTTY_EXPORT void ghostty_key_event_set_mods(GhosttyKeyEvent event, GhosttyMods mods); /** * Get the modifier keys bitmask. @@ -382,7 +382,7 @@ void ghostty_key_event_set_mods(GhosttyKeyEvent event, GhosttyMods mods); * * @ingroup key */ -GhosttyMods ghostty_key_event_get_mods(GhosttyKeyEvent event); +GHOSTTY_EXPORT GhosttyMods ghostty_key_event_get_mods(GhosttyKeyEvent event); /** * Set the consumed modifiers bitmask. @@ -392,7 +392,7 @@ GhosttyMods ghostty_key_event_get_mods(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_consumed_mods(GhosttyKeyEvent event, GhosttyMods consumed_mods); +GHOSTTY_EXPORT void ghostty_key_event_set_consumed_mods(GhosttyKeyEvent event, GhosttyMods consumed_mods); /** * Get the consumed modifiers bitmask. @@ -402,7 +402,7 @@ void ghostty_key_event_set_consumed_mods(GhosttyKeyEvent event, GhosttyMods cons * * @ingroup key */ -GhosttyMods ghostty_key_event_get_consumed_mods(GhosttyKeyEvent event); +GHOSTTY_EXPORT GhosttyMods ghostty_key_event_get_consumed_mods(GhosttyKeyEvent event); /** * Set whether the key event is part of a composition sequence. @@ -412,7 +412,7 @@ GhosttyMods ghostty_key_event_get_consumed_mods(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_composing(GhosttyKeyEvent event, bool composing); +GHOSTTY_EXPORT void ghostty_key_event_set_composing(GhosttyKeyEvent event, bool composing); /** * Get whether the key event is part of a composition sequence. @@ -422,7 +422,7 @@ void ghostty_key_event_set_composing(GhosttyKeyEvent event, bool composing); * * @ingroup key */ -bool ghostty_key_event_get_composing(GhosttyKeyEvent event); +GHOSTTY_EXPORT bool ghostty_key_event_get_composing(GhosttyKeyEvent event); /** * Set the UTF-8 text generated by the key for the current keyboard layout. @@ -442,7 +442,7 @@ bool ghostty_key_event_get_composing(GhosttyKeyEvent event); * * @ingroup key */ -void ghostty_key_event_set_utf8(GhosttyKeyEvent event, const char *utf8, size_t len); +GHOSTTY_EXPORT void ghostty_key_event_set_utf8(GhosttyKeyEvent event, const char *utf8, size_t len); /** * Get the UTF-8 text generated by the key event. @@ -455,7 +455,7 @@ void ghostty_key_event_set_utf8(GhosttyKeyEvent event, const char *utf8, size_t * * @ingroup key */ -const char *ghostty_key_event_get_utf8(GhosttyKeyEvent event, size_t *len); +GHOSTTY_EXPORT const char *ghostty_key_event_get_utf8(GhosttyKeyEvent event, size_t *len); /** * Set the unshifted Unicode codepoint. @@ -465,7 +465,7 @@ const char *ghostty_key_event_get_utf8(GhosttyKeyEvent event, size_t *len); * * @ingroup key */ -void ghostty_key_event_set_unshifted_codepoint(GhosttyKeyEvent event, uint32_t codepoint); +GHOSTTY_EXPORT void ghostty_key_event_set_unshifted_codepoint(GhosttyKeyEvent event, uint32_t codepoint); /** * Get the unshifted Unicode codepoint. @@ -475,6 +475,6 @@ void ghostty_key_event_set_unshifted_codepoint(GhosttyKeyEvent event, uint32_t c * * @ingroup key */ -uint32_t ghostty_key_event_get_unshifted_codepoint(GhosttyKeyEvent event); +GHOSTTY_EXPORT uint32_t ghostty_key_event_get_unshifted_codepoint(GhosttyKeyEvent event); #endif /* GHOSTTY_VT_KEY_EVENT_H */ diff --git a/include/ghostty/vt/modes.h b/include/ghostty/vt/modes.h index 53e148dd7..2cbad324c 100644 --- a/include/ghostty/vt/modes.h +++ b/include/ghostty/vt/modes.h @@ -180,7 +180,7 @@ typedef enum { * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer * is too small */ -GhosttyResult ghostty_mode_report_encode( +GHOSTTY_EXPORT GhosttyResult ghostty_mode_report_encode( GhosttyMode mode, GhosttyModeReportState state, char* buf, diff --git a/include/ghostty/vt/mouse/encoder.h b/include/ghostty/vt/mouse/encoder.h index 0640fd020..1547777c8 100644 --- a/include/ghostty/vt/mouse/encoder.h +++ b/include/ghostty/vt/mouse/encoder.h @@ -131,7 +131,7 @@ typedef enum { * * @ingroup mouse */ -GhosttyResult ghostty_mouse_encoder_new(const GhosttyAllocator *allocator, +GHOSTTY_EXPORT GhosttyResult ghostty_mouse_encoder_new(const GhosttyAllocator *allocator, GhosttyMouseEncoder *encoder); /** @@ -141,7 +141,7 @@ GhosttyResult ghostty_mouse_encoder_new(const GhosttyAllocator *allocator, * * @ingroup mouse */ -void ghostty_mouse_encoder_free(GhosttyMouseEncoder encoder); +GHOSTTY_EXPORT void ghostty_mouse_encoder_free(GhosttyMouseEncoder encoder); /** * Set an option on the mouse encoder. @@ -154,7 +154,7 @@ void ghostty_mouse_encoder_free(GhosttyMouseEncoder encoder); * * @ingroup mouse */ -void ghostty_mouse_encoder_setopt(GhosttyMouseEncoder encoder, +GHOSTTY_EXPORT void ghostty_mouse_encoder_setopt(GhosttyMouseEncoder encoder, GhosttyMouseEncoderOption option, const void *value); @@ -169,7 +169,7 @@ void ghostty_mouse_encoder_setopt(GhosttyMouseEncoder encoder, * * @ingroup mouse */ -void ghostty_mouse_encoder_setopt_from_terminal(GhosttyMouseEncoder encoder, +GHOSTTY_EXPORT void ghostty_mouse_encoder_setopt_from_terminal(GhosttyMouseEncoder encoder, GhosttyTerminal terminal); /** @@ -181,7 +181,7 @@ void ghostty_mouse_encoder_setopt_from_terminal(GhosttyMouseEncoder encoder, * * @ingroup mouse */ -void ghostty_mouse_encoder_reset(GhosttyMouseEncoder encoder); +GHOSTTY_EXPORT void ghostty_mouse_encoder_reset(GhosttyMouseEncoder encoder); /** * Encode a mouse event into a terminal escape sequence. @@ -202,7 +202,7 @@ void ghostty_mouse_encoder_reset(GhosttyMouseEncoder encoder); * * @ingroup mouse */ -GhosttyResult ghostty_mouse_encoder_encode(GhosttyMouseEncoder encoder, +GHOSTTY_EXPORT GhosttyResult ghostty_mouse_encoder_encode(GhosttyMouseEncoder encoder, GhosttyMouseEvent event, char *out_buf, size_t out_buf_size, diff --git a/include/ghostty/vt/mouse/event.h b/include/ghostty/vt/mouse/event.h index 65edf591b..fb140e0e7 100644 --- a/include/ghostty/vt/mouse/event.h +++ b/include/ghostty/vt/mouse/event.h @@ -77,7 +77,7 @@ typedef struct { * * @ingroup mouse */ -GhosttyResult ghostty_mouse_event_new(const GhosttyAllocator *allocator, +GHOSTTY_EXPORT GhosttyResult ghostty_mouse_event_new(const GhosttyAllocator *allocator, GhosttyMouseEvent *event); /** @@ -87,7 +87,7 @@ GhosttyResult ghostty_mouse_event_new(const GhosttyAllocator *allocator, * * @ingroup mouse */ -void ghostty_mouse_event_free(GhosttyMouseEvent event); +GHOSTTY_EXPORT void ghostty_mouse_event_free(GhosttyMouseEvent event); /** * Set the event action. @@ -97,7 +97,7 @@ void ghostty_mouse_event_free(GhosttyMouseEvent event); * * @ingroup mouse */ -void ghostty_mouse_event_set_action(GhosttyMouseEvent event, +GHOSTTY_EXPORT void ghostty_mouse_event_set_action(GhosttyMouseEvent event, GhosttyMouseAction action); /** @@ -108,7 +108,7 @@ void ghostty_mouse_event_set_action(GhosttyMouseEvent event, * * @ingroup mouse */ -GhosttyMouseAction ghostty_mouse_event_get_action(GhosttyMouseEvent event); +GHOSTTY_EXPORT GhosttyMouseAction ghostty_mouse_event_get_action(GhosttyMouseEvent event); /** * Set the event button. @@ -122,7 +122,7 @@ GhosttyMouseAction ghostty_mouse_event_get_action(GhosttyMouseEvent event); * * @ingroup mouse */ -void ghostty_mouse_event_set_button(GhosttyMouseEvent event, +GHOSTTY_EXPORT void ghostty_mouse_event_set_button(GhosttyMouseEvent event, GhosttyMouseButton button); /** @@ -134,7 +134,7 @@ void ghostty_mouse_event_set_button(GhosttyMouseEvent event, * * @ingroup mouse */ -void ghostty_mouse_event_clear_button(GhosttyMouseEvent event); +GHOSTTY_EXPORT void ghostty_mouse_event_clear_button(GhosttyMouseEvent event); /** * Get the event button. @@ -145,7 +145,7 @@ void ghostty_mouse_event_clear_button(GhosttyMouseEvent event); * * @ingroup mouse */ -bool ghostty_mouse_event_get_button(GhosttyMouseEvent event, +GHOSTTY_EXPORT bool ghostty_mouse_event_get_button(GhosttyMouseEvent event, GhosttyMouseButton *out_button); /** @@ -156,7 +156,7 @@ bool ghostty_mouse_event_get_button(GhosttyMouseEvent event, * * @ingroup mouse */ -void ghostty_mouse_event_set_mods(GhosttyMouseEvent event, +GHOSTTY_EXPORT void ghostty_mouse_event_set_mods(GhosttyMouseEvent event, GhosttyMods mods); /** @@ -167,7 +167,7 @@ void ghostty_mouse_event_set_mods(GhosttyMouseEvent event, * * @ingroup mouse */ -GhosttyMods ghostty_mouse_event_get_mods(GhosttyMouseEvent event); +GHOSTTY_EXPORT GhosttyMods ghostty_mouse_event_get_mods(GhosttyMouseEvent event); /** * Set the event position in surface-space pixels. @@ -177,7 +177,7 @@ GhosttyMods ghostty_mouse_event_get_mods(GhosttyMouseEvent event); * * @ingroup mouse */ -void ghostty_mouse_event_set_position(GhosttyMouseEvent event, +GHOSTTY_EXPORT void ghostty_mouse_event_set_position(GhosttyMouseEvent event, GhosttyMousePosition position); /** @@ -188,6 +188,6 @@ void ghostty_mouse_event_set_position(GhosttyMouseEvent event, * * @ingroup mouse */ -GhosttyMousePosition ghostty_mouse_event_get_position(GhosttyMouseEvent event); +GHOSTTY_EXPORT GhosttyMousePosition ghostty_mouse_event_get_position(GhosttyMouseEvent event); #endif /* GHOSTTY_VT_MOUSE_EVENT_H */ diff --git a/include/ghostty/vt/osc.h b/include/ghostty/vt/osc.h index cf0a8a417..f248d59e3 100644 --- a/include/ghostty/vt/osc.h +++ b/include/ghostty/vt/osc.h @@ -123,7 +123,7 @@ typedef enum { * * @ingroup osc */ -GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser); +GHOSTTY_EXPORT GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser); /** * Free an OSC parser instance. @@ -135,7 +135,7 @@ GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParse * * @ingroup osc */ -void ghostty_osc_free(GhosttyOscParser parser); +GHOSTTY_EXPORT void ghostty_osc_free(GhosttyOscParser parser); /** * Reset an OSC parser instance to its initial state. @@ -148,7 +148,7 @@ void ghostty_osc_free(GhosttyOscParser parser); * * @ingroup osc */ -void ghostty_osc_reset(GhosttyOscParser parser); +GHOSTTY_EXPORT void ghostty_osc_reset(GhosttyOscParser parser); /** * Parse the next byte in an OSC sequence. @@ -165,7 +165,7 @@ void ghostty_osc_reset(GhosttyOscParser parser); * * @ingroup osc */ -void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); +GHOSTTY_EXPORT void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); /** * Finalize OSC parsing and retrieve the parsed command. @@ -195,7 +195,7 @@ void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); * * @ingroup osc */ -GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); +GHOSTTY_EXPORT GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); /** * Get the type of an OSC command. @@ -209,7 +209,7 @@ GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); * * @ingroup osc */ -GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); +GHOSTTY_EXPORT GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); /** * Extract data from an OSC command. @@ -226,7 +226,7 @@ GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); * * @ingroup osc */ -bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData data, void *out); +GHOSTTY_EXPORT bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData data, void *out); /** @} */ diff --git a/include/ghostty/vt/paste.h b/include/ghostty/vt/paste.h index bf91ca64b..488be4c2a 100644 --- a/include/ghostty/vt/paste.h +++ b/include/ghostty/vt/paste.h @@ -55,7 +55,7 @@ extern "C" { * @param len The length of the data in bytes * @return true if the data is safe to paste, false otherwise */ -bool ghostty_paste_is_safe(const char* data, size_t len); +GHOSTTY_EXPORT bool ghostty_paste_is_safe(const char* data, size_t len); /** * Encode paste data for writing to the terminal pty. @@ -84,7 +84,7 @@ bool ghostty_paste_is_safe(const char* data, size_t len); * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer * is too small */ -GhosttyResult ghostty_paste_encode( +GHOSTTY_EXPORT GhosttyResult ghostty_paste_encode( char* data, size_t data_len, bool bracketed, diff --git a/include/ghostty/vt/render.h b/include/ghostty/vt/render.h index 1d1e13d25..83bab1439 100644 --- a/include/ghostty/vt/render.h +++ b/include/ghostty/vt/render.h @@ -299,7 +299,7 @@ typedef struct { * * @ingroup render */ -GhosttyResult ghostty_render_state_new(const GhosttyAllocator* allocator, +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_new(const GhosttyAllocator* allocator, GhosttyRenderState* state); /** @@ -312,7 +312,7 @@ GhosttyResult ghostty_render_state_new(const GhosttyAllocator* allocator, * * @ingroup render */ -void ghostty_render_state_free(GhosttyRenderState state); +GHOSTTY_EXPORT void ghostty_render_state_free(GhosttyRenderState state); /** * Update a render state instance from a terminal. @@ -328,7 +328,7 @@ void ghostty_render_state_free(GhosttyRenderState state); * * @ingroup render */ -GhosttyResult ghostty_render_state_update(GhosttyRenderState state, +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_update(GhosttyRenderState state, GhosttyTerminal terminal); /** @@ -345,7 +345,7 @@ GhosttyResult ghostty_render_state_update(GhosttyRenderState state, * * @ingroup render */ -GhosttyResult ghostty_render_state_get(GhosttyRenderState state, +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_get(GhosttyRenderState state, GhosttyRenderStateData data, void* out); @@ -364,7 +364,7 @@ GhosttyResult ghostty_render_state_get(GhosttyRenderState state, * * @ingroup render */ -GhosttyResult ghostty_render_state_set(GhosttyRenderState state, +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_set(GhosttyRenderState state, GhosttyRenderStateOption option, const void* value); @@ -383,7 +383,7 @@ GhosttyResult ghostty_render_state_set(GhosttyRenderState state, * * @ingroup render */ -GhosttyResult ghostty_render_state_colors_get(GhosttyRenderState state, +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_colors_get(GhosttyRenderState state, GhosttyRenderStateColors* out_colors); /** @@ -400,7 +400,7 @@ GhosttyResult ghostty_render_state_colors_get(GhosttyRenderState state, * * @ingroup render */ -GhosttyResult ghostty_render_state_row_iterator_new( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_iterator_new( const GhosttyAllocator* allocator, GhosttyRenderStateRowIterator* out_iterator); @@ -411,7 +411,7 @@ GhosttyResult ghostty_render_state_row_iterator_new( * * @ingroup render */ -void ghostty_render_state_row_iterator_free(GhosttyRenderStateRowIterator iterator); +GHOSTTY_EXPORT void ghostty_render_state_row_iterator_free(GhosttyRenderStateRowIterator iterator); /** * Move a render-state row iterator to the next row. @@ -425,7 +425,7 @@ void ghostty_render_state_row_iterator_free(GhosttyRenderStateRowIterator iterat * * @ingroup render */ -bool ghostty_render_state_row_iterator_next(GhosttyRenderStateRowIterator iterator); +GHOSTTY_EXPORT bool ghostty_render_state_row_iterator_next(GhosttyRenderStateRowIterator iterator); /** * Get a value from the current row in a render-state row iterator. @@ -443,7 +443,7 @@ bool ghostty_render_state_row_iterator_next(GhosttyRenderStateRowIterator iterat * * @ingroup render */ -GhosttyResult ghostty_render_state_row_get( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_get( GhosttyRenderStateRowIterator iterator, GhosttyRenderStateRowData data, void* out); @@ -465,7 +465,7 @@ GhosttyResult ghostty_render_state_row_get( * * @ingroup render */ -GhosttyResult ghostty_render_state_row_set( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_set( GhosttyRenderStateRowIterator iterator, GhosttyRenderStateRowOption option, const void* value); @@ -487,7 +487,7 @@ GhosttyResult ghostty_render_state_row_set( * * @ingroup render */ -GhosttyResult ghostty_render_state_row_cells_new( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_cells_new( const GhosttyAllocator* allocator, GhosttyRenderStateRowCells* out_cells); @@ -544,7 +544,7 @@ typedef enum { * * @ingroup render */ -bool ghostty_render_state_row_cells_next(GhosttyRenderStateRowCells cells); +GHOSTTY_EXPORT bool ghostty_render_state_row_cells_next(GhosttyRenderStateRowCells cells); /** * Move a render-state row cells iterator to a specific column. @@ -560,7 +560,7 @@ bool ghostty_render_state_row_cells_next(GhosttyRenderStateRowCells cells); * * @ingroup render */ -GhosttyResult ghostty_render_state_row_cells_select( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_cells_select( GhosttyRenderStateRowCells cells, uint16_t x); /** @@ -580,7 +580,7 @@ GhosttyResult ghostty_render_state_row_cells_select( * * @ingroup render */ -GhosttyResult ghostty_render_state_row_cells_get( +GHOSTTY_EXPORT GhosttyResult ghostty_render_state_row_cells_get( GhosttyRenderStateRowCells cells, GhosttyRenderStateRowCellsData data, void* out); @@ -592,7 +592,7 @@ GhosttyResult ghostty_render_state_row_cells_get( * * @ingroup render */ -void ghostty_render_state_row_cells_free(GhosttyRenderStateRowCells cells); +GHOSTTY_EXPORT void ghostty_render_state_row_cells_free(GhosttyRenderStateRowCells cells); /** @} */ diff --git a/include/ghostty/vt/screen.h b/include/ghostty/vt/screen.h index f1f9dd1ca..eed0de222 100644 --- a/include/ghostty/vt/screen.h +++ b/include/ghostty/vt/screen.h @@ -307,7 +307,7 @@ typedef enum { * * @ingroup screen */ -GhosttyResult ghostty_cell_get(GhosttyCell cell, +GHOSTTY_EXPORT GhosttyResult ghostty_cell_get(GhosttyCell cell, GhosttyCellData data, void *out); @@ -327,7 +327,7 @@ GhosttyResult ghostty_cell_get(GhosttyCell cell, * * @ingroup screen */ -GhosttyResult ghostty_row_get(GhosttyRow row, +GHOSTTY_EXPORT GhosttyResult ghostty_row_get(GhosttyRow row, GhosttyRowData data, void *out); diff --git a/include/ghostty/vt/sgr.h b/include/ghostty/vt/sgr.h index afaa18145..40c7efd6d 100644 --- a/include/ghostty/vt/sgr.h +++ b/include/ghostty/vt/sgr.h @@ -184,7 +184,7 @@ typedef struct { * * @ingroup sgr */ -GhosttyResult ghostty_sgr_new(const GhosttyAllocator* allocator, +GHOSTTY_EXPORT GhosttyResult ghostty_sgr_new(const GhosttyAllocator* allocator, GhosttySgrParser* parser); /** @@ -198,7 +198,7 @@ GhosttyResult ghostty_sgr_new(const GhosttyAllocator* allocator, * * @ingroup sgr */ -void ghostty_sgr_free(GhosttySgrParser parser); +GHOSTTY_EXPORT void ghostty_sgr_free(GhosttySgrParser parser); /** * Reset an SGR parser instance to the beginning of the parameter list. @@ -211,7 +211,7 @@ void ghostty_sgr_free(GhosttySgrParser parser); * * @ingroup sgr */ -void ghostty_sgr_reset(GhosttySgrParser parser); +GHOSTTY_EXPORT void ghostty_sgr_reset(GhosttySgrParser parser); /** * Set SGR parameters for parsing. @@ -243,7 +243,7 @@ void ghostty_sgr_reset(GhosttySgrParser parser); * * @ingroup sgr */ -GhosttyResult ghostty_sgr_set_params(GhosttySgrParser parser, +GHOSTTY_EXPORT GhosttyResult ghostty_sgr_set_params(GhosttySgrParser parser, const uint16_t* params, const char* separators, size_t len); @@ -261,7 +261,7 @@ GhosttyResult ghostty_sgr_set_params(GhosttySgrParser parser, * * @ingroup sgr */ -bool ghostty_sgr_next(GhosttySgrParser parser, GhosttySgrAttribute* attr); +GHOSTTY_EXPORT bool ghostty_sgr_next(GhosttySgrParser parser, GhosttySgrAttribute* attr); /** * Get the full parameter list from an unknown SGR attribute. @@ -276,7 +276,7 @@ bool ghostty_sgr_next(GhosttySgrParser parser, GhosttySgrAttribute* attr); * * @ingroup sgr */ -size_t ghostty_sgr_unknown_full(GhosttySgrUnknown unknown, +GHOSTTY_EXPORT size_t ghostty_sgr_unknown_full(GhosttySgrUnknown unknown, const uint16_t** ptr); /** @@ -292,7 +292,7 @@ size_t ghostty_sgr_unknown_full(GhosttySgrUnknown unknown, * * @ingroup sgr */ -size_t ghostty_sgr_unknown_partial(GhosttySgrUnknown unknown, +GHOSTTY_EXPORT size_t ghostty_sgr_unknown_partial(GhosttySgrUnknown unknown, const uint16_t** ptr); /** @@ -307,7 +307,7 @@ size_t ghostty_sgr_unknown_partial(GhosttySgrUnknown unknown, * * @ingroup sgr */ -GhosttySgrAttributeTag ghostty_sgr_attribute_tag(GhosttySgrAttribute attr); +GHOSTTY_EXPORT GhosttySgrAttributeTag ghostty_sgr_attribute_tag(GhosttySgrAttribute attr); /** * Get the value from an SGR attribute. @@ -321,7 +321,7 @@ GhosttySgrAttributeTag ghostty_sgr_attribute_tag(GhosttySgrAttribute attr); * * @ingroup sgr */ -GhosttySgrAttributeValue* ghostty_sgr_attribute_value( +GHOSTTY_EXPORT GhosttySgrAttributeValue* ghostty_sgr_attribute_value( GhosttySgrAttribute* attr); #ifdef __wasm__ @@ -335,7 +335,7 @@ GhosttySgrAttributeValue* ghostty_sgr_attribute_value( * * @ingroup wasm */ -GhosttySgrAttribute* ghostty_wasm_alloc_sgr_attribute(void); +GHOSTTY_EXPORT GhosttySgrAttribute* ghostty_wasm_alloc_sgr_attribute(void); /** * Free memory for an SGR attribute (WebAssembly only). @@ -346,7 +346,7 @@ GhosttySgrAttribute* ghostty_wasm_alloc_sgr_attribute(void); * * @ingroup wasm */ -void ghostty_wasm_free_sgr_attribute(GhosttySgrAttribute* attr); +GHOSTTY_EXPORT void ghostty_wasm_free_sgr_attribute(GhosttySgrAttribute* attr); #endif #ifdef __cplusplus diff --git a/include/ghostty/vt/size_report.h b/include/ghostty/vt/size_report.h index b2eb08995..cf18b2418 100644 --- a/include/ghostty/vt/size_report.h +++ b/include/ghostty/vt/size_report.h @@ -84,7 +84,7 @@ typedef struct { * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer * is too small */ -GhosttyResult ghostty_size_report_encode( +GHOSTTY_EXPORT GhosttyResult ghostty_size_report_encode( GhosttySizeReportStyle style, GhosttySizeReportSize size, char* buf, diff --git a/include/ghostty/vt/style.h b/include/ghostty/vt/style.h index ac5cd2ad6..86a177178 100644 --- a/include/ghostty/vt/style.h +++ b/include/ghostty/vt/style.h @@ -115,7 +115,7 @@ typedef struct { * * @ingroup style */ -void ghostty_style_default(GhosttyStyle* style); +GHOSTTY_EXPORT void ghostty_style_default(GhosttyStyle* style); /** * Check if a style is the default style. @@ -127,7 +127,7 @@ void ghostty_style_default(GhosttyStyle* style); * * @ingroup style */ -bool ghostty_style_is_default(const GhosttyStyle* style); +GHOSTTY_EXPORT bool ghostty_style_is_default(const GhosttyStyle* style); #ifdef __cplusplus } diff --git a/include/ghostty/vt/terminal.h b/include/ghostty/vt/terminal.h index dfbe4e1a0..f7670741a 100644 --- a/include/ghostty/vt/terminal.h +++ b/include/ghostty/vt/terminal.h @@ -768,7 +768,7 @@ typedef enum { * * @ingroup terminal */ -GhosttyResult ghostty_terminal_new(const GhosttyAllocator* allocator, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_new(const GhosttyAllocator* allocator, GhosttyTerminal* terminal, GhosttyTerminalOptions options); @@ -782,7 +782,7 @@ GhosttyResult ghostty_terminal_new(const GhosttyAllocator* allocator, * * @ingroup terminal */ -void ghostty_terminal_free(GhosttyTerminal terminal); +GHOSTTY_EXPORT void ghostty_terminal_free(GhosttyTerminal terminal); /** * Perform a full reset of the terminal (RIS). @@ -795,7 +795,7 @@ void ghostty_terminal_free(GhosttyTerminal terminal); * * @ingroup terminal */ -void ghostty_terminal_reset(GhosttyTerminal terminal); +GHOSTTY_EXPORT void ghostty_terminal_reset(GhosttyTerminal terminal); /** * Resize the terminal to the given dimensions. @@ -818,7 +818,7 @@ void ghostty_terminal_reset(GhosttyTerminal terminal); * * @ingroup terminal */ -GhosttyResult ghostty_terminal_resize(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_resize(GhosttyTerminal terminal, uint16_t cols, uint16_t rows, uint32_t cell_width_px, @@ -844,7 +844,7 @@ GhosttyResult ghostty_terminal_resize(GhosttyTerminal terminal, * * @ingroup terminal */ -GhosttyResult ghostty_terminal_set(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_set(GhosttyTerminal terminal, GhosttyTerminalOption option, const void* value); @@ -869,7 +869,7 @@ GhosttyResult ghostty_terminal_set(GhosttyTerminal terminal, * * @ingroup terminal */ -void ghostty_terminal_vt_write(GhosttyTerminal terminal, +GHOSTTY_EXPORT void ghostty_terminal_vt_write(GhosttyTerminal terminal, const uint8_t* data, size_t len); @@ -886,7 +886,7 @@ void ghostty_terminal_vt_write(GhosttyTerminal terminal, * * @ingroup terminal */ -void ghostty_terminal_scroll_viewport(GhosttyTerminal terminal, +GHOSTTY_EXPORT void ghostty_terminal_scroll_viewport(GhosttyTerminal terminal, GhosttyTerminalScrollViewport behavior); /** @@ -903,7 +903,7 @@ void ghostty_terminal_scroll_viewport(GhosttyTerminal terminal, * * @ingroup terminal */ -GhosttyResult ghostty_terminal_mode_get(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_mode_get(GhosttyTerminal terminal, GhosttyMode mode, bool* out_value); @@ -920,7 +920,7 @@ GhosttyResult ghostty_terminal_mode_get(GhosttyTerminal terminal, * * @ingroup terminal */ -GhosttyResult ghostty_terminal_mode_set(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_mode_set(GhosttyTerminal terminal, GhosttyMode mode, bool value); @@ -940,7 +940,7 @@ GhosttyResult ghostty_terminal_mode_set(GhosttyTerminal terminal, * * @ingroup terminal */ -GhosttyResult ghostty_terminal_get(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_get(GhosttyTerminal terminal, GhosttyTerminalData data, void *out); @@ -970,7 +970,7 @@ GhosttyResult ghostty_terminal_get(GhosttyTerminal terminal, * * @ingroup terminal */ -GhosttyResult ghostty_terminal_grid_ref(GhosttyTerminal terminal, +GHOSTTY_EXPORT GhosttyResult ghostty_terminal_grid_ref(GhosttyTerminal terminal, GhosttyPoint point, GhosttyGridRef *out_ref); diff --git a/include/ghostty/vt/types.h b/include/ghostty/vt/types.h index e3d668e29..0263f905f 100644 --- a/include/ghostty/vt/types.h +++ b/include/ghostty/vt/types.h @@ -10,6 +10,28 @@ #include #include +// Symbol visibility for shared library builds. On Windows, functions +// are exported from the DLL when building and imported when consuming. +// On other platforms with GCC/Clang, functions are marked with default +// visibility so they remain accessible when the library is built with +// -fvisibility=hidden. For static library builds, define GHOSTTY_STATIC +// before including this header to make this a no-op. +#ifndef GHOSTTY_EXPORT +#if defined(GHOSTTY_STATIC) + #define GHOSTTY_EXPORT +#elif defined(_WIN32) || defined(_WIN64) + #ifdef GHOSTTY_BUILD_SHARED + #define GHOSTTY_EXPORT __declspec(dllexport) + #else + #define GHOSTTY_EXPORT __declspec(dllimport) + #endif +#elif defined(__GNUC__) && __GNUC__ >= 4 + #define GHOSTTY_EXPORT __attribute__((visibility("default"))) +#else + #define GHOSTTY_EXPORT +#endif +#endif + /** * Result codes for libghostty-vt operations. */ diff --git a/include/ghostty/vt/wasm.h b/include/ghostty/vt/wasm.h index 37a826326..b7e1f3f62 100644 --- a/include/ghostty/vt/wasm.h +++ b/include/ghostty/vt/wasm.h @@ -11,6 +11,7 @@ #include #include +#include /** @defgroup wasm WebAssembly Utilities * @@ -74,7 +75,7 @@ * @return Pointer to allocated opaque pointer, or NULL if allocation failed * @ingroup wasm */ -void** ghostty_wasm_alloc_opaque(void); +GHOSTTY_EXPORT void** ghostty_wasm_alloc_opaque(void); /** * Free an opaque pointer allocated by ghostty_wasm_alloc_opaque(). @@ -82,7 +83,7 @@ void** ghostty_wasm_alloc_opaque(void); * @param ptr Pointer to free, or NULL (NULL is safely ignored) * @ingroup wasm */ -void ghostty_wasm_free_opaque(void **ptr); +GHOSTTY_EXPORT void ghostty_wasm_free_opaque(void **ptr); /** * Allocate an array of uint8_t values. @@ -91,7 +92,7 @@ void ghostty_wasm_free_opaque(void **ptr); * @return Pointer to allocated array, or NULL if allocation failed * @ingroup wasm */ -uint8_t* ghostty_wasm_alloc_u8_array(size_t len); +GHOSTTY_EXPORT uint8_t* ghostty_wasm_alloc_u8_array(size_t len); /** * Free an array allocated by ghostty_wasm_alloc_u8_array(). @@ -100,7 +101,7 @@ uint8_t* ghostty_wasm_alloc_u8_array(size_t len); * @param len Length of the array (must match the length passed to alloc) * @ingroup wasm */ -void ghostty_wasm_free_u8_array(uint8_t *ptr, size_t len); +GHOSTTY_EXPORT void ghostty_wasm_free_u8_array(uint8_t *ptr, size_t len); /** * Allocate an array of uint16_t values. @@ -109,7 +110,7 @@ void ghostty_wasm_free_u8_array(uint8_t *ptr, size_t len); * @return Pointer to allocated array, or NULL if allocation failed * @ingroup wasm */ -uint16_t* ghostty_wasm_alloc_u16_array(size_t len); +GHOSTTY_EXPORT uint16_t* ghostty_wasm_alloc_u16_array(size_t len); /** * Free an array allocated by ghostty_wasm_alloc_u16_array(). @@ -118,7 +119,7 @@ uint16_t* ghostty_wasm_alloc_u16_array(size_t len); * @param len Length of the array (must match the length passed to alloc) * @ingroup wasm */ -void ghostty_wasm_free_u16_array(uint16_t *ptr, size_t len); +GHOSTTY_EXPORT void ghostty_wasm_free_u16_array(uint16_t *ptr, size_t len); /** * Allocate a single uint8_t value. @@ -126,7 +127,7 @@ void ghostty_wasm_free_u16_array(uint16_t *ptr, size_t len); * @return Pointer to allocated uint8_t, or NULL if allocation failed * @ingroup wasm */ -uint8_t* ghostty_wasm_alloc_u8(void); +GHOSTTY_EXPORT uint8_t* ghostty_wasm_alloc_u8(void); /** * Free a uint8_t allocated by ghostty_wasm_alloc_u8(). @@ -134,7 +135,7 @@ uint8_t* ghostty_wasm_alloc_u8(void); * @param ptr Pointer to free, or NULL (NULL is safely ignored) * @ingroup wasm */ -void ghostty_wasm_free_u8(uint8_t *ptr); +GHOSTTY_EXPORT void ghostty_wasm_free_u8(uint8_t *ptr); /** * Allocate a single size_t value. @@ -142,7 +143,7 @@ void ghostty_wasm_free_u8(uint8_t *ptr); * @return Pointer to allocated size_t, or NULL if allocation failed * @ingroup wasm */ -size_t* ghostty_wasm_alloc_usize(void); +GHOSTTY_EXPORT size_t* ghostty_wasm_alloc_usize(void); /** * Free a size_t allocated by ghostty_wasm_alloc_usize(). @@ -150,7 +151,7 @@ size_t* ghostty_wasm_alloc_usize(void); * @param ptr Pointer to free, or NULL (NULL is safely ignored) * @ingroup wasm */ -void ghostty_wasm_free_usize(size_t *ptr); +GHOSTTY_EXPORT void ghostty_wasm_free_usize(size_t *ptr); /** @} */