Skip to content

Commit a940dd2

Browse files
authored
Merge pull request #562 from blahgeek/fix-visibility
Do not export unnecessary symbols in dynamic library
2 parents ed6e867 + 0edf26d commit a940dd2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ endif()
1212
add_library(vterm-module MODULE vterm-module.c utf8.c elisp.c)
1313
set_target_properties(vterm-module PROPERTIES
1414
C_STANDARD 99
15+
C_VISIBILITY_PRESET "hidden"
1516
POSITION_INDEPENDENT_CODE ON
1617
PREFIX ""
1718
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}

vterm-module.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@
66
#include <stdbool.h>
77
#include <vterm.h>
88

9-
int plugin_is_GPL_compatible;
9+
// https://gcc.gnu.org/wiki/Visibility
10+
#if defined _WIN32 || defined __CYGWIN__
11+
#ifdef __GNUC__
12+
#define VTERM_EXPORT __attribute__ ((dllexport))
13+
#else
14+
#define VTERM_EXPORT __declspec(dllexport)
15+
#endif
16+
#else
17+
#if __GNUC__ >= 4
18+
#define VTERM_EXPORT __attribute__ ((visibility ("default")))
19+
#else
20+
#define VTERM_EXPORT
21+
#endif
22+
#endif
23+
24+
VTERM_EXPORT int plugin_is_GPL_compatible;
1025

1126
#define SB_MAX 100000 // Maximum 'scrollback' value.
1227

@@ -147,6 +162,6 @@ emacs_value Fvterm_get_prompt_point(emacs_env *env, ptrdiff_t nargs,
147162
emacs_value Fvterm_reset_cursor_point(emacs_env *env, ptrdiff_t nargs,
148163
emacs_value args[], void *data);
149164

150-
int emacs_module_init(struct emacs_runtime *ert);
165+
VTERM_EXPORT int emacs_module_init(struct emacs_runtime *ert);
151166

152167
#endif /* VTERM_MODULE_H */

0 commit comments

Comments
 (0)