summaryrefslogtreecommitdiffhomepage
path: root/src/internal/perk_visibility_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/perk_visibility_impl.h')
-rw-r--r--src/internal/perk_visibility_impl.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/internal/perk_visibility_impl.h b/src/internal/perk_visibility_impl.h
new file mode 100644
index 0000000..0057b8b
--- /dev/null
+++ b/src/internal/perk_visibility_impl.h
@@ -0,0 +1,26 @@
+#ifndef PERK_VISIBILITY_IMPL_H
+#define PERK_VISIBILITY_IMPL_H
+
+/**********************************************************************/
+/* PE targets: __dllexport suffices for the purpose of exporting only */
+/* the desired subset of global symbols; this makes the visibility */
+/* attribute not only redundant, but also tricky if not properly */
+/* supported by the toolchain. */
+/* */
+/* When targeting Midipix hosts, where elf-like visibility is fully */
+/* supported and may be detected via the __PE_VISIBILITY__ macro, */
+/* we utilize the attribute to render private symbols invisibile */
+/* to dlsym(), as well as reduce the size of the .gotstrs section. */
+/**********************************************************************/
+
+#if defined(__PE_VISIBILITY__)
+#define perk_hidden _ATTR_VISIBILITY_HIDDEN
+#elif defined(__PE__)
+#define perk_hidden
+#elif defined(_ATTR_VISIBILITY_HIDDEN)
+#define perk_hidden _ATTR_VISIBILITY_HIDDEN
+#else
+#define perk_hidden
+#endif
+
+#endif