Skip to content

Commit

Permalink
Merge pull request #562 from blahgeek/fix-visibility
Browse files Browse the repository at this point in the history
Do not export unnecessary symbols in dynamic library
  • Loading branch information
jixiuf authored Dec 26, 2021
2 parents ed6e867 + 0edf26d commit a940dd2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ endif()
add_library(vterm-module MODULE vterm-module.c utf8.c elisp.c)
set_target_properties(vterm-module PROPERTIES
C_STANDARD 99
C_VISIBILITY_PRESET "hidden"
POSITION_INDEPENDENT_CODE ON
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down
19 changes: 17 additions & 2 deletions vterm-module.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@
#include <stdbool.h>
#include <vterm.h>

int plugin_is_GPL_compatible;
// https://gcc.gnu.org/wiki/Visibility
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define VTERM_EXPORT __attribute__ ((dllexport))
#else
#define VTERM_EXPORT __declspec(dllexport)
#endif
#else
#if __GNUC__ >= 4
#define VTERM_EXPORT __attribute__ ((visibility ("default")))
#else
#define VTERM_EXPORT
#endif
#endif

VTERM_EXPORT int plugin_is_GPL_compatible;

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

Expand Down Expand Up @@ -147,6 +162,6 @@ emacs_value Fvterm_get_prompt_point(emacs_env *env, ptrdiff_t nargs,
emacs_value Fvterm_reset_cursor_point(emacs_env *env, ptrdiff_t nargs,
emacs_value args[], void *data);

int emacs_module_init(struct emacs_runtime *ert);
VTERM_EXPORT int emacs_module_init(struct emacs_runtime *ert);

#endif /* VTERM_MODULE_H */

0 comments on commit a940dd2

Please sign in to comment.