Skip to content

Commit

Permalink
build: correct export decoration macros (#38)
Browse files Browse the repository at this point in the history
This corrects the attribute for the export and import handling on
Windows.  It takes the opportunity to do a small optimization for
Linux to avoid the GOT in internal dispatch.
  • Loading branch information
compnerd authored Mar 10, 2022
1 parent fce0dee commit 3780d73
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/include/cmark-gfm_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@
# define CMARK_GFM_EXPORT
# define CMARK_GFM_NO_EXPORT
#else
# ifndef CMARK_GFM_EXPORT
# ifdef libcmark_gfm_EXPORTS
/* We are building this library */
# define CMARK_GFM_EXPORT __attribute__((visibility("default")))
# if defined(_WIN32)
# if defined(libcmark_gfm_EXPORTS)
# define CMARK_GFM_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define CMARK_GFM_EXPORT __attribute__((visibility("default")))
# define CMARK_GFM_EXPORT __declspec(dllimport)
# endif
# endif

# ifndef CMARK_GFM_NO_EXPORT
# define CMARK_GFM_NO_EXPORT __attribute__((visibility("hidden")))
# define CMARK_GFM_NO_EXPORT
# else
# if defined(libcmark_gfm_EXPORTS)
# if defined(__linux__)
# define CMARK_GFM_EXPORT __attribute__((__visibility__("protected")))
# else
# define CMARK_GFM_EXPORT __attribute__((__visibility__("default")))
# endif
# else
# define CMARK_GFM_EXPORT __attribute__((__visibility__("default")))
# endif
# define CMARK_GFM_NO_EXPORT __attribute__((__visibility__("hidden")))
# endif
#endif

Expand Down

0 comments on commit 3780d73

Please sign in to comment.