[waffle] [PATCH 16/19] wgl: restrict exported symbols via module-definition file
Emil Velikov
emil.l.velikov at gmail.com
Mon Aug 4 10:09:55 PDT 2014
msvc complains if the function declaration does not match its
definition (__declspec(dllexport)) thus to avoid messing up
with the public header, simply use a .def file.
v2: Drop the library prefix (lib) for the DLL.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>(v1)
Acked-by: Chad Versace <chad.versace at linux.intel.com>(v1)
---
Last iteration of previous patch, dropped the lib prefix for the
library, thus we need to update the LIBRARY name of the DEF file.
-Emil
src/waffle/CMakeLists.txt | 12 ++++++++++++
src/waffle/api/api_priv.h | 3 ++-
src/waffle/waffle.def.in | 33 +++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 src/waffle/waffle.def.in
diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index af71f0d..dfc748e 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -171,6 +171,18 @@ set_source_files_properties(
LANGUAGE C
)
+if(waffle_on_windows)
+ configure_file(
+ waffle.def.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${waffle_libname}.def
+ @ONLY
+ )
+
+ list(APPEND waffle_sources
+ ${waffle_libname}.def
+ )
+endif()
+
include_directories(
${GLX_INLCLUDE_DIRS}
${X11_INCLUDE_DIRS}
diff --git a/src/waffle/api/api_priv.h b/src/waffle/api/api_priv.h
index 1fec575..51cf53c 100644
--- a/src/waffle/api/api_priv.h
+++ b/src/waffle/api/api_priv.h
@@ -39,7 +39,8 @@
// TODO: Implement WAFFLE_API for Apple.
//
#if defined(_WIN32)
-# define WAFFLE_API __declspec(dllexport)
+// Use module-definition file to restrict the exported symbols under windows.
+# define WAFFLE_API
#elif defined(__GNUC__) && __GNUC__ >= 4
# define WAFFLE_API __attribute__ ((visibility("default")))
#else
diff --git a/src/waffle/waffle.def.in b/src/waffle/waffle.def.in
new file mode 100644
index 0000000..db8464f
--- /dev/null
+++ b/src/waffle/waffle.def.in
@@ -0,0 +1,33 @@
+LIBRARY @waffle_libname@
+
+EXPORTS
+ waffle_error_get_code
+ waffle_error_get_info
+ waffle_error_to_string
+ waffle_enum_to_string
+ waffle_init
+ waffle_make_current
+ waffle_get_proc_address
+ waffle_is_extension_in_string
+ waffle_display_connect
+ waffle_display_disconnect
+ waffle_display_supports_context_api
+ waffle_display_get_native
+ waffle_config_choose
+ waffle_config_destroy
+ waffle_config_get_native
+ waffle_context_create
+ waffle_context_destroy
+ waffle_context_get_native
+ waffle_window_create
+ waffle_window_destroy
+ waffle_window_show
+ waffle_window_swap_buffers
+ waffle_window_get_native
+ waffle_window_resize
+ waffle_dl_can_open
+ waffle_dl_sym
+ waffle_attrib_list_length
+ waffle_attrib_list_get
+ waffle_attrib_list_get_with_default
+ waffle_attrib_list_update
\ No newline at end of file
--
2.0.2
More information about the waffle
mailing list