[libgxps/wip/nacho/visibility: 1/5] Add GXPS_AVAILABLE_IN_ALL macro to handle the visibility of the methods



commit a2286690acd29df3f59656a176ea8221e68bd748
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Thu Sep 8 14:35:14 2016 +0200

    Add GXPS_AVAILABLE_IN_ALL macro to handle the visibility of the methods
    
    This is in preparation to add support for Visual studio projects
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771057

 configure.ac                      |   33 +++++++++++++++++++++++++++++++++
 libgxps/Makefile.am               |    7 ++++---
 libgxps/gxps-archive.h            |    7 +++++++
 libgxps/gxps-brush.h              |    4 ++++
 libgxps/gxps-color.h              |    1 +
 libgxps/gxps-core-properties.h    |   18 ++++++++++++++++++
 libgxps/gxps-debug.h              |    2 +-
 libgxps/gxps-document-structure.h |    7 +++++++
 libgxps/gxps-document.h           |    7 +++++++
 libgxps/gxps-error.h              |    2 ++
 libgxps/gxps-file.h               |    7 +++++++
 libgxps/gxps-fonts.h              |    1 +
 libgxps/gxps-glyphs.h             |    4 ++++
 libgxps/gxps-images.h             |    2 ++
 libgxps/gxps-links.h              |   12 ++++++++++++
 libgxps/gxps-matrix.h             |    4 ++++
 libgxps/gxps-page-private.h       |    7 +++++++
 libgxps/gxps-page.h               |    7 +++++++
 libgxps/gxps-parse-utils.h        |   10 ++++++++++
 libgxps/gxps-path.h               |    4 ++++
 libgxps/gxps-version.h.in         |   25 +++++++++++++++++++++++++
 21 files changed, 167 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 034b034..bd0556a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,39 @@ AC_SUBST([GXPS_MICRO_VERSION],[gxps_micro_version])
 AC_SUBST([GXPS_LT_VERSION_INFO],[gxps_lt_version_info])
 AC_SUBST([GXPS_LT_CURRENT_MINUS_AGE],[gxps_lt_current_minus_age])
 
+##################################################
+# Visibility handling
+##################################################
+
+GXPS_HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+    *-*-mingw*)
+        dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
+        AC_DEFINE([_GXPS_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
+                  [defines how to decorate public symbols while building])
+        GXPS_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+        ;;
+    *)
+        dnl on other compilers, check if we can do -fvisibility=hidden
+        SAVED_CFLAGS="${CFLAGS}"
+        CFLAGS="-fvisibility=hidden"
+        AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+        AC_TRY_COMPILE([], [int main (void) { return 0; }],
+                       AC_MSG_RESULT(yes)
+                       enable_fvisibility_hidden=yes,
+                       AC_MSG_RESULT(no)
+                       enable_fvisibility_hidden=no)
+        CFLAGS="${SAVED_CFLAGS}"
+
+        AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
+            AC_DEFINE([_GXPS_EXTERN], [__attribute__((visibility("default"))) extern],
+                      [defines how to decorate public symbols while building])
+            GXPS_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+        ])
+        ;;
+esac
+AC_SUBST(GXPS_HIDDEN_VISIBILITY_CFLAGS)
+
 # *****************************************************************************
 # *****************************************************************************
 
diff --git a/libgxps/Makefile.am b/libgxps/Makefile.am
index 11d94a4..6537b31 100644
--- a/libgxps/Makefile.am
+++ b/libgxps/Makefile.am
@@ -63,12 +63,13 @@ libgxps_la_CFLAGS = \
        $(LCMS2_CFLAGS)         \
        $(LIBPNG_CFLAGS)        \
        $(WARN_CFLAGS)          \
-       $(AM_CFLAGS)
+       $(AM_CFLAGS)            \
+       $(GXPS_HIDDEN_VISIBILITY_CFLAGS)
 
 libgxps_la_LDFLAGS = \
        -version-info $(GXPS_LT_VERSION_INFO)   \
        -no-undefined                           \
-       -export-symbols-regex "^gxps_*"         \
+       -export-dynamic                         \
        $(AM_LDFLAGS)
 
 libgxps_la_LIBADD = \
@@ -110,4 +111,4 @@ typelibdir = $(libdir)/girepository-1.0
 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelib_DATA)
-endif
\ No newline at end of file
+endif
diff --git a/libgxps/gxps-archive.h b/libgxps/gxps-archive.h
index 330be37..b444ef2 100644
--- a/libgxps/gxps-archive.h
+++ b/libgxps/gxps-archive.h
@@ -23,6 +23,7 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 #include <archive.h>
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -36,14 +37,20 @@ G_BEGIN_DECLS
 typedef struct _GXPSArchive      GXPSArchive;
 typedef struct _GXPSArchiveClass GXPSArchiveClass;
 
+GXPS_AVAILABLE_IN_ALL
 GType             gxps_archive_get_type       (void) G_GNUC_CONST;
+
+GXPS_AVAILABLE_IN_ALL
 GXPSArchive      *gxps_archive_new            (GFile            *filename,
                                               GError          **error);
 
+GXPS_AVAILABLE_IN_ALL
 gboolean          gxps_archive_has_entry      (GXPSArchive      *archive,
                                               const gchar      *path);
+GXPS_AVAILABLE_IN_ALL
 GInputStream     *gxps_archive_open           (GXPSArchive      *archive,
                                               const gchar      *path);
+GXPS_AVAILABLE_IN_ALL
 gboolean          gxps_archive_read_entry     (GXPSArchive      *archive,
                                               const gchar      *path,
                                               guchar          **buffer,
diff --git a/libgxps/gxps-brush.h b/libgxps/gxps-brush.h
index be3d3ff..d101130 100644
--- a/libgxps/gxps-brush.h
+++ b/libgxps/gxps-brush.h
@@ -33,12 +33,16 @@ struct _GXPSBrush {
         gdouble            opacity;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GXPSBrush *gxps_brush_new               (GXPSRenderContext   *ctx);
+GXPS_AVAILABLE_IN_ALL
 void       gxps_brush_free              (GXPSBrush           *brush);
+GXPS_AVAILABLE_IN_ALL
 gboolean   gxps_brush_solid_color_parse (const gchar         *data,
                                          GXPSArchive         *zip,
                                          gdouble              alpha,
                                          cairo_pattern_t    **pattern);
+GXPS_AVAILABLE_IN_ALL
 void       gxps_brush_parser_push       (GMarkupParseContext *context,
                                          GXPSBrush           *brush);
 
diff --git a/libgxps/gxps-color.h b/libgxps/gxps-color.h
index 232693f..efd8aeb 100644
--- a/libgxps/gxps-color.h
+++ b/libgxps/gxps-color.h
@@ -34,6 +34,7 @@ typedef struct _GXPSColor {
         gdouble blue;
 } GXPSColor;
 
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_color_new_for_icc (GXPSArchive *zip,
                                  const gchar *icc_profile_uri,
                                  gdouble     *values,
diff --git a/libgxps/gxps-core-properties.h b/libgxps/gxps-core-properties.h
index 4444ad4..cc08b3d 100644
--- a/libgxps/gxps-core-properties.h
+++ b/libgxps/gxps-core-properties.h
@@ -25,6 +25,7 @@
 #define __GXPS_CORE_PROPERTIES_H__
 
 #include <glib-object.h>
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -56,23 +57,40 @@ struct _GXPSCorePropertiesClass {
         GObjectClass parent_class;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GType        gxps_core_properties_get_type             (void) G_GNUC_CONST;
 
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_title            (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_creator          (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_description      (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_subject          (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_keywords         (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_version          (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_revision         (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_identifier       (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_language         (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_category         (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_content_status   (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_content_type     (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 time_t       gxps_core_properties_get_created          (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 const gchar *gxps_core_properties_get_last_modified_by (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 time_t       gxps_core_properties_get_modified         (GXPSCoreProperties *core_props);
+GXPS_AVAILABLE_IN_ALL
 time_t       gxps_core_properties_get_last_printed     (GXPSCoreProperties *core_props);
 
 G_END_DECLS
diff --git a/libgxps/gxps-debug.h b/libgxps/gxps-debug.h
index 63a329e..78eaac5 100644
--- a/libgxps/gxps-debug.h
+++ b/libgxps/gxps-debug.h
@@ -24,7 +24,7 @@
 G_BEGIN_DECLS
 
 #ifdef GXPS_ENABLE_DEBUG
-gboolean gxps_debug_enabled (void);
+GXPS_VAR gboolean gxps_debug_enabled (void);
 #define GXPS_DEBUG(action) G_STMT_START {                \
                               if (gxps_debug_enabled ()) \
                                 action;                  \
diff --git a/libgxps/gxps-document-structure.h b/libgxps/gxps-document-structure.h
index 87e584b..0af5498 100644
--- a/libgxps/gxps-document-structure.h
+++ b/libgxps/gxps-document-structure.h
@@ -71,15 +71,22 @@ struct _GXPSOutlineIter {
        gpointer dummy2;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GType           gxps_document_structure_get_type          (void) G_GNUC_CONST;
 
+GXPS_AVAILABLE_IN_ALL
 gboolean        gxps_document_structure_has_outline       (GXPSDocumentStructure *structure);
+GXPS_AVAILABLE_IN_ALL
 gboolean        gxps_document_structure_outline_iter_init (GXPSOutlineIter       *iter,
                                                           GXPSDocumentStructure *structure);
+GXPS_AVAILABLE_IN_ALL
 gboolean        gxps_outline_iter_next                    (GXPSOutlineIter       *iter);
+GXPS_AVAILABLE_IN_ALL
 gboolean        gxps_outline_iter_children                (GXPSOutlineIter       *iter,
                                                           GXPSOutlineIter       *parent);
+GXPS_AVAILABLE_IN_ALL
 const gchar    *gxps_outline_iter_get_description         (GXPSOutlineIter       *iter);
+GXPS_AVAILABLE_IN_ALL
 GXPSLinkTarget *gxps_outline_iter_get_target              (GXPSOutlineIter       *iter);
 
 G_END_DECLS
diff --git a/libgxps/gxps-document.h b/libgxps/gxps-document.h
index a2aee20..9177d2e 100644
--- a/libgxps/gxps-document.h
+++ b/libgxps/gxps-document.h
@@ -29,6 +29,7 @@
 
 #include "gxps-page.h"
 #include "gxps-document-structure.h"
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -60,18 +61,24 @@ struct _GXPSDocumentClass {
        GObjectClass parent_class;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GType                  gxps_document_get_type            (void) G_GNUC_CONST;
 
+GXPS_AVAILABLE_IN_ALL
 guint                  gxps_document_get_n_pages         (GXPSDocument *doc);
+GXPS_AVAILABLE_IN_ALL
 GXPSPage              *gxps_document_get_page            (GXPSDocument *doc,
                                                          guint         n_page,
                                                          GError      **error);
+GXPS_AVAILABLE_IN_ALL
 gboolean               gxps_document_get_page_size       (GXPSDocument *doc,
                                                          guint         n_page,
                                                          gdouble      *width,
                                                          gdouble      *height);
+GXPS_AVAILABLE_IN_ALL
 gint                   gxps_document_get_page_for_anchor (GXPSDocument *doc,
                                                          const gchar  *anchor);
+GXPS_AVAILABLE_IN_ALL
 GXPSDocumentStructure *gxps_document_get_structure       (GXPSDocument *doc);
 
 G_END_DECLS
diff --git a/libgxps/gxps-error.h b/libgxps/gxps-error.h
index a29d5dc..148380f 100644
--- a/libgxps/gxps-error.h
+++ b/libgxps/gxps-error.h
@@ -25,6 +25,7 @@
 #define __GXPS_ERROR_H__
 
 #include <glib.h>
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -51,6 +52,7 @@ typedef enum {
        GXPS_ERROR_IMAGE
 } GXPSError;
 
+GXPS_AVAILABLE_IN_ALL
 GQuark gxps_error_quark (void) G_GNUC_CONST;
 
 G_END_DECLS
diff --git a/libgxps/gxps-file.h b/libgxps/gxps-file.h
index 250f31a..66d8a89 100644
--- a/libgxps/gxps-file.h
+++ b/libgxps/gxps-file.h
@@ -80,17 +80,24 @@ struct _GXPSFileClass {
        GObjectClass parent_class;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GType               gxps_file_get_type                     (void) G_GNUC_CONST;
+GXPS_AVAILABLE_IN_ALL
 GQuark              gxps_file_error_quark                  (void) G_GNUC_CONST;
+GXPS_AVAILABLE_IN_ALL
 GXPSFile           *gxps_file_new                          (GFile          *filename,
                                                             GError        **error);
 
+GXPS_AVAILABLE_IN_ALL
 guint               gxps_file_get_n_documents              (GXPSFile       *xps);
+GXPS_AVAILABLE_IN_ALL
 GXPSDocument       *gxps_file_get_document                 (GXPSFile       *xps,
                                                             guint           n_doc,
                                                             GError        **error);
+GXPS_AVAILABLE_IN_ALL
 gint                gxps_file_get_document_for_link_target (GXPSFile       *xps,
                                                             GXPSLinkTarget *target);
+GXPS_AVAILABLE_IN_ALL
 GXPSCoreProperties *gxps_file_get_core_properties          (GXPSFile       *xps,
                                                             GError        **error);
 
diff --git a/libgxps/gxps-fonts.h b/libgxps/gxps-fonts.h
index a127c6f..90fc432 100644
--- a/libgxps/gxps-fonts.h
+++ b/libgxps/gxps-fonts.h
@@ -25,6 +25,7 @@
 
 G_BEGIN_DECLS
 
+GXPS_AVAILABLE_IN_ALL
 cairo_font_face_t *gxps_fonts_get_font (GXPSArchive *zip,
                                        const gchar *font_uri,
                                        GError     **error);
diff --git a/libgxps/gxps-glyphs.h b/libgxps/gxps-glyphs.h
index 1e35c7c..8121137 100644
--- a/libgxps/gxps-glyphs.h
+++ b/libgxps/gxps-glyphs.h
@@ -45,12 +45,15 @@ struct _GXPSGlyphs {
         guint              italic      : 1;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GXPSGlyphs *gxps_glyphs_new             (GXPSRenderContext     *ctx,
                                          gchar                 *font_uri,
                                          gdouble                font_size,
                                          gdouble                origin_x,
                                          gdouble                origin_y);
+GXPS_AVAILABLE_IN_ALL
 void        gxps_glyphs_free            (GXPSGlyphs            *glyphs);
+GXPS_AVAILABLE_IN_ALL
 gboolean    gxps_glyphs_to_cairo_glyphs (GXPSGlyphs            *gxps_glyphs,
                                          cairo_scaled_font_t   *scaled_font,
                                          const gchar           *utf8,
@@ -59,6 +62,7 @@ gboolean    gxps_glyphs_to_cairo_glyphs (GXPSGlyphs            *gxps_glyphs,
                                          cairo_text_cluster_t **clusters,
                                          int                   *num_clusters,
                                          GError               **error);
+GXPS_AVAILABLE_IN_ALL
 void        gxps_glyphs_parser_push     (GMarkupParseContext   *context,
                                          GXPSGlyphs            *glyphs);
 
diff --git a/libgxps/gxps-images.h b/libgxps/gxps-images.h
index 81cfdc9..fdf35f9 100644
--- a/libgxps/gxps-images.h
+++ b/libgxps/gxps-images.h
@@ -33,9 +33,11 @@ struct _GXPSImage {
        double           res_y;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GXPSImage *gxps_images_get_image (GXPSArchive  *zip,
                                   const gchar  *image_uri,
                                   GError      **error);
+GXPS_AVAILABLE_IN_ALL
 void       gxps_image_free       (GXPSImage    *image);
 
 G_END_DECLS
diff --git a/libgxps/gxps-links.h b/libgxps/gxps-links.h
index 22bf6b4..d8bd7a3 100644
--- a/libgxps/gxps-links.h
+++ b/libgxps/gxps-links.h
@@ -26,6 +26,7 @@
 
 #include <glib-object.h>
 #include <cairo.h>
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -46,18 +47,29 @@ typedef struct _GXPSLink       GXPSLink;
  */
 typedef struct _GXPSLinkTarget GXPSLinkTarget;
 
+GXPS_AVAILABLE_IN_ALL
 GType           gxps_link_get_type            (void) G_GNUC_CONST;
+GXPS_AVAILABLE_IN_ALL
 GXPSLink       *gxps_link_copy                (GXPSLink          *link);
+GXPS_AVAILABLE_IN_ALL
 void            gxps_link_free                (GXPSLink          *link);
+GXPS_AVAILABLE_IN_ALL
 GXPSLinkTarget *gxps_link_get_target          (GXPSLink          *link);
+GXPS_AVAILABLE_IN_ALL
 void            gxps_link_get_area            (GXPSLink          *link,
                                               cairo_rectangle_t *area);
 
+GXPS_AVAILABLE_IN_ALL
 GType           gxps_link_target_get_type     (void) G_GNUC_CONST;
+GXPS_AVAILABLE_IN_ALL
 GXPSLinkTarget *gxps_link_target_copy         (GXPSLinkTarget    *target);
+GXPS_AVAILABLE_IN_ALL
 void            gxps_link_target_free         (GXPSLinkTarget    *target);
+GXPS_AVAILABLE_IN_ALL
 gboolean        gxps_link_target_is_internal  (GXPSLinkTarget    *target);
+GXPS_AVAILABLE_IN_ALL
 const gchar    *gxps_link_target_get_anchor   (GXPSLinkTarget    *target);
+GXPS_AVAILABLE_IN_ALL
 const gchar    *gxps_link_target_get_uri      (GXPSLinkTarget    *target);
 
 G_END_DECLS
diff --git a/libgxps/gxps-matrix.h b/libgxps/gxps-matrix.h
index 215ea34..3693d53 100644
--- a/libgxps/gxps-matrix.h
+++ b/libgxps/gxps-matrix.h
@@ -32,10 +32,14 @@ struct _GXPSMatrix {
         cairo_matrix_t     matrix;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GXPSMatrix *gxps_matrix_new         (GXPSRenderContext   *ctx);
+GXPS_AVAILABLE_IN_ALL
 void        gxps_matrix_free        (GXPSMatrix          *matrix);
+GXPS_AVAILABLE_IN_ALL
 gboolean    gxps_matrix_parse       (const gchar         *data,
                                      cairo_matrix_t      *matrix);
+GXPS_AVAILABLE_IN_ALL
 void        gxps_matrix_parser_push (GMarkupParseContext *context,
                                      GXPSMatrix          *matrix);
 
diff --git a/libgxps/gxps-page-private.h b/libgxps/gxps-page-private.h
index 9dab52c..f4d299c 100644
--- a/libgxps/gxps-page-private.h
+++ b/libgxps/gxps-page-private.h
@@ -58,9 +58,16 @@ struct _GXPSRenderContext {
         GXPSBrushVisual *visual;
 };
 
+/* FIXME: these methods are suppose to be private but they were exported
+ * before adding the AVALABLE macros, so we keep them exported to not break
+ * the abi. If in the future we break the abi for some reason we could remove
+ * these exports.
+ */
+GXPS_AVAILABLE_IN_ALL
 GXPSImage *gxps_page_get_image          (GXPSPage            *page,
                                          const gchar         *image_uri,
                                          GError             **error);
+GXPS_AVAILABLE_IN_ALL
 void       gxps_page_render_parser_push (GMarkupParseContext *context,
                                          GXPSRenderContext   *ctx);
 
diff --git a/libgxps/gxps-page.h b/libgxps/gxps-page.h
index 5bd6a5a..f87e9ef 100644
--- a/libgxps/gxps-page.h
+++ b/libgxps/gxps-page.h
@@ -27,6 +27,7 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 #include <cairo.h>
+#include "gxps-version.h"
 
 G_BEGIN_DECLS
 
@@ -81,17 +82,23 @@ struct _GXPSPageClass {
        GObjectClass parent_class;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GType    gxps_page_get_type               (void) G_GNUC_CONST;
+GXPS_AVAILABLE_IN_ALL
 GQuark   gxps_page_error_quark            (void) G_GNUC_CONST;
 
+GXPS_AVAILABLE_IN_ALL
 void     gxps_page_get_size               (GXPSPage          *page,
                                           gdouble           *width,
                                           gdouble           *height);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_page_render                 (GXPSPage          *page,
                                           cairo_t           *cr,
                                           GError           **error);
+GXPS_AVAILABLE_IN_ALL
 GList   *gxps_page_get_links              (GXPSPage          *page,
                                           GError           **error);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_page_get_anchor_destination (GXPSPage          *page,
                                           const gchar       *anchor,
                                           cairo_rectangle_t *area,
diff --git a/libgxps/gxps-parse-utils.h b/libgxps/gxps-parse-utils.h
index d5cb341..9392c17 100644
--- a/libgxps/gxps-parse-utils.h
+++ b/libgxps/gxps-parse-utils.h
@@ -24,9 +24,11 @@
 
 G_BEGIN_DECLS
 
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_parse_stream                  (GMarkupParseContext  *context,
                                              GInputStream         *stream,
                                              GError              **error);
+GXPS_AVAILABLE_IN_ALL
 void     gxps_parse_error                   (GMarkupParseContext  *context,
                                              const gchar          *source,
                                              GMarkupError          error_type,
@@ -34,21 +36,29 @@ void     gxps_parse_error                   (GMarkupParseContext  *context,
                                              const gchar          *attribute_name,
                                              const gchar          *content,
                                              GError              **error);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_value_get_int                 (const gchar          *value,
                                              gint                 *int_value);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_value_get_double              (const gchar          *value,
                                              gdouble              *double_value);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_value_get_double_positive     (const gchar          *value,
                                              gdouble              *double_value);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_value_get_double_non_negative (const gchar          *value,
                                              gdouble              *double_value);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_value_get_boolean             (const gchar          *value,
                                              gboolean             *boolean_value);
+GXPS_AVAILABLE_IN_ALL
 gboolean gxps_point_parse                   (const gchar          *point,
                                              gdouble              *x,
                                              gdouble              *y);
+GXPS_AVAILABLE_IN_ALL
 void     gxps_parse_skip_number             (gchar               **iter,
                                              const gchar          *end);
+GXPS_AVAILABLE_IN_ALL
 gchar   *gxps_resolve_relative_path         (const gchar          *source,
                                              const gchar          *target);
 
diff --git a/libgxps/gxps-path.h b/libgxps/gxps-path.h
index fd21982..0524e5e 100644
--- a/libgxps/gxps-path.h
+++ b/libgxps/gxps-path.h
@@ -50,12 +50,16 @@ struct _GXPSPath {
         gboolean           is_closed  : 1;
 };
 
+GXPS_AVAILABLE_IN_ALL
 GXPSPath *gxps_path_new         (GXPSRenderContext   *ctx);
+GXPS_AVAILABLE_IN_ALL
 void      gxps_path_free        (GXPSPath            *path);
+GXPS_AVAILABLE_IN_ALL
 gboolean  gxps_path_parse       (const gchar         *data,
                                  cairo_t             *cr,
                                  GError             **error);
 
+GXPS_AVAILABLE_IN_ALL
 void      gxps_path_parser_push (GMarkupParseContext *context,
                                  GXPSPath            *path);
 
diff --git a/libgxps/gxps-version.h.in b/libgxps/gxps-version.h.in
index 6bd54cd..d82e102 100644
--- a/libgxps/gxps-version.h.in
+++ b/libgxps/gxps-version.h.in
@@ -82,4 +82,29 @@
          (GXPS_MAJOR_VERSION == (major) && GXPS_MINOR_VERSION > (minor)) || \
          (GXPS_MAJOR_VERSION == (major) && GXPS_MINOR_VERSION == (minor) && GXPS_MICRO_VERSION >= (micro)))
 
+#ifndef _GXPS_EXTERN
+#define _GXPS_EXTERN extern
+#endif
+
+/* We prefix variable declarations so they can
+ * properly get exported in Windows DLLs.
+ */
+#ifndef GXPS_VAR
+#  ifdef G_PLATFORM_WIN32
+#    ifdef GXPS_COMPILATION
+#      ifdef DLL_EXPORT
+#        define GXPS_VAR __declspec(dllexport)
+#      else /* !DLL_EXPORT */
+#        define GXPS_VAR extern
+#      endif /* !DLL_EXPORT */
+#    else /* !GXPS_COMPILATION */
+#      define GXPS_VAR extern __declspec(dllimport)
+#    endif /* !GXPS_COMPILATION */
+#  else /* !G_PLATFORM_WIN32 */
+#    define GXPS_VAR _GXPS_EXTERN
+#  endif /* !G_PLATFORM_WIN32 */
+#endif /* GXPS_VAR */
+
+#define GXPS_AVAILABLE_IN_ALL                   _GXPS_EXTERN
+
 #endif /* __GXPS_VERSION_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]