diff --git a/CMakeLists.txt b/CMakeLists.txt index af4f2d5..e766884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} diff --git a/vterm-module.h b/vterm-module.h index 5cb1f6d..96f538f 100644 --- a/vterm-module.h +++ b/vterm-module.h @@ -6,7 +6,22 @@ #include #include -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. @@ -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 */