[babl/wip/msvc] babl: Export the symbols on MSVC builds too
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl/wip/msvc] babl: Export the symbols on MSVC builds too
- Date: Mon, 20 Jan 2020 09:58:20 +0000 (UTC)
commit b01be2033b8be41ae2465bac3debf058f88a32d7
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jan 20 17:47:31 2020 +0800
babl: Export the symbols on MSVC builds too
Export all the public symbols, as well as the private symbols that we need for
the extensions and tests, using __declspec(dllexport) when
BABL_IS_BEING_COMPILED is defined
babl/babl-class.h | 3 +++
babl/babl-db.h | 1 +
babl/babl-internal.h | 13 ++++++++++++
babl/babl-introspect.h | 1 +
babl/babl-macros.h | 6 ++++++
babl/babl-memory.h | 1 +
babl/babl-polynomial.h | 1 +
babl/babl-util.h | 1 +
babl/babl-version.h.in | 1 +
babl/babl.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
babl/meson.build | 3 ++-
11 files changed, 84 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-class.h b/babl/babl-class.h
index ceada22b6..fe8f9d105 100644
--- a/babl/babl-class.h
+++ b/babl/babl-class.h
@@ -35,8 +35,11 @@ typedef int (*BablEachFunction) (Babl *entry,
*/
#define BABL_CLASS_DECLARE(klass) \
\
+BABL_API
\
BablDb * babl_##klass##_db (void); \
+BABL_API
\
const Babl * babl_##klass##_from_id (int id); \
+BABL_API
\
void babl_##klass##_class_for_each (BablEachFunction each_fun, \
void *user_data)
diff --git a/babl/babl-db.h b/babl/babl-db.h
index 9b170d1cb..74590645d 100644
--- a/babl/babl-db.h
+++ b/babl/babl-db.h
@@ -42,6 +42,7 @@ typedef struct _BablDb
static BablDb *db = NULL;
#endif /* NEEDS_BABL_DB */
+BABL_API
BablDb *
babl_db_init (void);
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index b3c97854f..dd8be194c 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -70,9 +70,12 @@ long babl_conversion_cost (BablConversion *conversion);
Babl * babl_extension_base (void);
+BABL_API
Babl * babl_extender (void);
+BABL_API
void babl_set_extender (Babl *new_extender);
+BABL_API
Babl * babl_extension_quiet_log (void);
void babl_extension_deinit (void);
@@ -85,6 +88,7 @@ void babl_fish_reference_process (const Babl *babl,
Babl * babl_fish_reference (const Babl *source,
const Babl *destination);
Babl * babl_fish_simple (BablConversion *conversion);
+BABL_API
Babl * babl_fish_path (const Babl *source,
const Babl *destination);
@@ -96,8 +100,10 @@ Babl * babl_image_from_linear (char *buffer,
const Babl *format);
Babl * babl_image_double_from_image (const Babl *source);
+BABL_API
double babl_model_is_symmetric (const Babl *babl);
void babl_die (void);
+BABL_API
int babl_sanity (void);
void babl_doc (const Babl *babl,
@@ -108,7 +114,9 @@ const char * babl_get_doc (const Babl *babl);
void babl_core_init (void);
const Babl *babl_format_with_model_as_type (const Babl *model,
const Babl *type);
+BABL_API
int babl_formats_count (void); /* should maybe be
templated? */
+BABL_API
int babl_type_is_symmetric (const Babl *babl);
/**** LOGGER ****/
@@ -255,6 +263,7 @@ extern BablMutex *babl_reference_mutex;
extern BablMutex *babl_debug_mutex;
#endif
+BABL_API
const char *babl_class_name (BablClassType klass);
void babl_internal_init (void);
void babl_internal_destroy (void);
@@ -369,7 +378,9 @@ babl_trc_new (const char *name,
int n_lut,
float *lut);
+BABL_API
void babl_space_to_xyz (const Babl *space, const double *rgb, double *xyz);
+BABL_API
void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
const Babl *babl_trc_lut_find (float *lut, int lut_size);
@@ -410,6 +421,7 @@ int _babl_file_get_contents (const char *path,
Returns the double-precision 3x3 matrix used to convert linear
RGB data to CIE XYZ.
*/
+BABL_API
const double * babl_space_get_rgbtoxyz (const Babl *space);
/* babl_space_to_xyz:
@@ -457,6 +469,7 @@ typedef enum {
BABL_ICC_COMPACT_TRC_LUT = 1,
} BablICCFlags;
+BABL_API
char *babl_space_to_icc (const Babl *space,
const char *description,
const char *copyright,
diff --git a/babl/babl-introspect.h b/babl/babl-introspect.h
index d1640310f..0fd6552c3 100644
--- a/babl/babl-introspect.h
+++ b/babl/babl-introspect.h
@@ -27,6 +27,7 @@
*
* introspect a given BablObject
*/
+BABL_API
void babl_introspect (Babl *babl);
diff --git a/babl/babl-macros.h b/babl/babl-macros.h
index a286e6373..c71f51b66 100644
--- a/babl/babl-macros.h
+++ b/babl/babl-macros.h
@@ -36,4 +36,10 @@
#define BABL_GNUC_ATTRIBUTE_UNUSED
#endif
+#if defined (_MSC_VER) && defined (BABL_IS_BEING_COMPILED)
+#define BABL_API __declspec (dllexport)
+#else
+#define BABL_API
+#endif
+
#endif /* _BABL_MACROS_H */
diff --git a/babl/babl-memory.h b/babl/babl-memory.h
index eb55c8d72..291e06fe8 100644
--- a/babl/babl-memory.h
+++ b/babl/babl-memory.h
@@ -28,6 +28,7 @@ void babl_set_malloc (BablMallocFunc malloc_function);
void babl_set_free (BablFreeFunc free_function);
int babl_memory_sanity (void);
+BABL_API
void * babl_malloc (size_t size);
void babl_set_destructor (void *ptr,
int (*destructor)(void *ptr));
diff --git a/babl/babl-polynomial.h b/babl/babl-polynomial.h
index 233c74311..565dd5201 100644
--- a/babl/babl-polynomial.h
+++ b/babl/babl-polynomial.h
@@ -67,6 +67,7 @@ babl_polynomial_eval (const BablPolynomial *poly,
* that minimizes the total error w.r.t. the gamma function `gamma`, over the
* range `[x0, x1]`.
*/
+BABL_API
void
babl_polynomial_approximate_gamma (BablPolynomial *poly,
double gamma,
diff --git a/babl/babl-util.h b/babl/babl-util.h
index 9caec36dc..a2c65c19e 100644
--- a/babl/babl-util.h
+++ b/babl/babl-util.h
@@ -19,6 +19,7 @@
#ifndef _BABL_UTIL_H
#define _BABL_UTIL_H
+BABL_API
long
babl_ticks (void);
diff --git a/babl/babl-version.h.in b/babl/babl-version.h.in
index 305ac061e..a78de8f68 100644
--- a/babl/babl-version.h.in
+++ b/babl/babl-version.h.in
@@ -44,6 +44,7 @@
*
* Get the version information on the babl library
*/
+BABL_API
void babl_get_version (int *major,
int *minor,
int *micro);
diff --git a/babl/babl.h b/babl/babl.h
index 3c025bb80..745b903dc 100644
--- a/babl/babl.h
+++ b/babl/babl.h
@@ -35,6 +35,7 @@ extern "C" {
*
* Initializes the babl library.
*/
+BABL_API
void babl_init (void);
/**
@@ -43,6 +44,7 @@ void babl_init (void);
* Deinitializes the babl library and frees any resources used when
* matched with the number of calls to babl_init().
*/
+BABL_API
void babl_exit (void);
/**
@@ -51,6 +53,7 @@ void babl_exit (void);
* Returns the babl object representing the data type given by @name
* such as for example "u8", "u16" or "float".
*/
+BABL_API
const Babl * babl_type (const char *name);
/**
@@ -60,6 +63,7 @@ const Babl * babl_type (const char *name);
* sampling such as for example 2, 2 for the chroma components in
* YCbCr.
*/
+BABL_API
const Babl * babl_sampling (int horizontal,
int vertical);
@@ -70,6 +74,7 @@ const Babl * babl_sampling (int horizontal,
* Returns the babl object representing the color component given by
* @name such as for example "R", "cyan" or "CIE L".
*/
+BABL_API
const Babl * babl_component (const char *name);
/**
@@ -78,6 +83,7 @@ const Babl * babl_component (const char *name);
* Returns the babl object representing the color model given by @name
* such as for example "RGB", "CMYK" or "CIE Lab".
*/
+BABL_API
const Babl * babl_model (const char *name);
/**
@@ -86,6 +92,7 @@ const Babl * babl_model (const char *name);
* The models for formats also have a space in babl, try to avoid code
* needing to use this.
*/
+BABL_API
const Babl *
babl_model_with_space (const char *name, const Babl *space);
@@ -98,6 +105,7 @@ babl_model_with_space (const char *name, const Babl *space);
* sRGB, Rec2020, Adobish, Apple and ProPhoto
*
*/
+BABL_API
const Babl * babl_space (const char *name);
typedef enum {
@@ -130,6 +138,7 @@ typedef enum {
* containing a message describing why the provided data does not yield a babl
* space.
*/
+BABL_API
const Babl *babl_space_from_icc (const char *icc_data,
int icc_length,
BablIccIntent intent,
@@ -137,6 +146,7 @@ const Babl *babl_space_from_icc (const char *icc_data,
// XXX : deprecated
+BABL_API
const Babl *babl_icc_make_space (const char *icc_data,
int icc_length,
BablIccIntent intent,
@@ -157,6 +167,7 @@ const Babl *babl_icc_make_space (const char *icc_data,
* "profile-class", "color-space" and "pcs".
*/
+BABL_API
char *babl_icc_get_key (const char *icc_data,
int icc_length,
const char *key,
@@ -172,6 +183,7 @@ char *babl_icc_get_key (const char *icc_data,
* creates a format using the sRGB space, to also specify the color space
* and TRCs for a format, see babl_format_with_space.
*/
+BABL_API
const Babl * babl_format (const char *encoding);
/**
@@ -184,6 +196,7 @@ const Babl * babl_format (const char *encoding);
* the unsuffixed version is used. If a format is passed in as space
* the space of the format is used.
*/
+BABL_API
const Babl * babl_format_with_space (const char *encoding, const Babl *space);
/**
@@ -193,6 +206,7 @@ const Babl * babl_format_with_space (const char *encoding, const Babl *space);
* not. Can also be used to verify that specific extension formats are
* available (though this can also be inferred from the version of babl).
*/
+BABL_API
int babl_format_exists (const char *name);
/*
@@ -200,6 +214,7 @@ int babl_format_exists (const char *name);
*
* Retrieve the RGB color space used for a pixel format.
*/
+BABL_API
const Babl * babl_format_get_space (const Babl *format);
@@ -210,6 +225,7 @@ const Babl * babl_format_get_space (const Babl *format);
* destination_format, source and destination can be either strings
* with the names of the formats or Babl-format objects.
*/
+BABL_API
const Babl * babl_fish (const void *source_format,
const void *destination_format);
@@ -228,6 +244,7 @@ const Babl * babl_fish (const void *source_format,
* otherwise be a leak.
*
*/
+BABL_API
const Babl * babl_fast_fish (const void *source_format,
const void *destination_format,
const char *performance);
@@ -238,12 +255,14 @@ const Babl * babl_fast_fish (const void *source_format,
* Process n pixels from source to destination using babl_fish,
* returns number of pixels converted.
*/
+BABL_API
long babl_process (const Babl *babl_fish,
const void *source,
void *destination,
long n);
+BABL_API
long babl_process_rows (const Babl *babl_fish,
const void *source,
int source_stride,
@@ -258,6 +277,7 @@ long babl_process_rows (const Babl *babl_fish,
*
* Returns a string describing a Babl object.
*/
+BABL_API
const char * babl_get_name (const Babl *babl);
/**
@@ -265,6 +285,7 @@ const char * babl_get_name (const Babl *babl);
*
* Returns whether the @format has an alpha channel.
*/
+BABL_API
int babl_format_has_alpha (const Babl *format);
/**
@@ -272,6 +293,7 @@ int babl_format_has_alpha (const Babl *format);
*
* Returns the bytes per pixel for a babl color format.
*/
+BABL_API
int babl_format_get_bytes_per_pixel (const Babl *format);
/**
@@ -279,6 +301,7 @@ int babl_format_get_bytes_per_pixel (const Babl *format);
*
* Return the model used for constructing the format.
*/
+BABL_API
const Babl * babl_format_get_model (const Babl *format);
@@ -322,6 +345,7 @@ typedef enum
* but we do not have a lack of bits in this bit pattern so leave it be.
*/
+BABL_API
BablModelFlag babl_get_model_flags (const Babl *model);
/**
@@ -329,6 +353,7 @@ BablModelFlag babl_get_model_flags (const Babl *model);
*
* Returns the number of components for the given @format.
*/
+BABL_API
int babl_format_get_n_components (const Babl *format);
/**
@@ -337,6 +362,7 @@ int babl_format_get_n_components (const Babl *format);
* Returns the type in the given @format for the given
* @component_index.
*/
+BABL_API
const Babl * babl_format_get_type (const Babl *format,
int component_index);
@@ -354,6 +380,7 @@ const Babl * babl_format_get_type (const Babl *format,
* ["max_val", double max_val,]
* NULL);
*/
+BABL_API
const Babl * babl_type_new (void *first_arg,
...) BABL_ARG_NULL_TERMINATED;
@@ -365,6 +392,7 @@ const Babl * babl_type_new (void *first_arg,
* babl_component_new (const char *name,
* NULL);
*/
+BABL_API
const Babl * babl_component_new (void *first_arg,
...) BABL_ARG_NULL_TERMINATED;
@@ -379,6 +407,7 @@ const Babl * babl_component_new (void *first_arg,
* [BablComponent *componentN, ...]
* NULL);
*/
+BABL_API
const Babl * babl_model_new (void *first_arg,
...) BABL_ARG_NULL_TERMINATED;
@@ -401,6 +430,7 @@ const Babl * babl_model_new (void *first_arg,
* ["planar",]
* NULL);
*/
+BABL_API
const Babl * babl_format_new (const void *first_arg,
...) BABL_ARG_NULL_TERMINATED;
@@ -412,6 +442,7 @@ const Babl * babl_format_new (const void *first_arg,
* conversions are only well defined to other babl_format_n derived formats
* with the same number of components.
*/
+BABL_API
const Babl *
babl_format_n (const Babl *type,
int components);
@@ -421,6 +452,7 @@ babl_format_n (const Babl *type,
*
* Returns whether the @format is a format_n type.
*/
+BABL_API
int babl_format_is_format_n (const Babl *format);
/**
@@ -435,6 +467,7 @@ int babl_format_is_format_n (const Babl *format);
* <"linear"|"planar">, <BablFuncLinear | BablFuncPlanar> conv_func,
* NULL);
*/
+BABL_API
const Babl * babl_conversion_new (const void *first_arg,
...) BABL_ARG_NULL_TERMINATED;
@@ -443,6 +476,7 @@ const Babl * babl_conversion_new (const void *first_arg,
*
* Returns the RGB space defined for the source of conversion.
*/
+BABL_API
const Babl *babl_conversion_get_source_space (const Babl *conversion);
/**
@@ -450,6 +484,7 @@ const Babl *babl_conversion_get_source_space (const Babl *conversion);
*
* Returns the RGB space defined for the destination of conversion.
*/
+BABL_API
const Babl *babl_conversion_get_destination_space (const Babl *conversion);
/**
@@ -461,6 +496,7 @@ const Babl *babl_conversion_get_destination_space (const Babl *conversion);
* you pass in the same name the previous formats will be provided
* again.
*/
+BABL_API
const Babl *babl_new_palette (const char *name,
const Babl **format_u8,
const Babl **format_u8_with_alpha);
@@ -474,6 +510,7 @@ const Babl *babl_new_palette (const char *name,
* you pass in the same name the previous formats will be provided
* again.
*/
+BABL_API
const Babl *babl_new_palette_with_space (const char *name,
const Babl *space,
const Babl **format_u8,
@@ -484,6 +521,7 @@ const Babl *babl_new_palette_with_space (const char *name,
*
* check whether a format is a palette backed format.
*/
+BABL_API
int babl_format_is_palette (const Babl *format);
/**
@@ -496,6 +534,7 @@ int babl_format_is_palette (const Babl *format);
* Assign a palette to a palette format, the data is a single span of pixels
* representing the colors of the palette.
*/
+BABL_API
void babl_palette_set_palette (const Babl *babl,
const Babl *format,
void *data,
@@ -507,6 +546,7 @@ void babl_palette_set_palette (const Babl *babl,
* reset a palette to initial state, frees up some caches that optimize
* conversions.
*/
+BABL_API
void babl_palette_reset (const Babl *babl);
@@ -518,6 +558,7 @@ void babl_palette_reset (const Babl *babl);
* similar with the data, perhaps this should be made internal API, not
* accesible at all from
*/
+BABL_API
void babl_set_user_data (const Babl *babl, void *data);
/**
@@ -525,6 +566,7 @@ void babl_set_user_data (const Babl *babl, void *data);
*
* Get data set with babl_set_user_data
*/
+BABL_API
void * babl_get_user_data (const Babl *babl);
typedef enum {
@@ -558,6 +600,7 @@ typedef enum {
* Internally this does the math to derive the RGBXYZ matrix as used in an ICC
* profile.
*/
+BABL_API
const Babl * babl_space_from_chromaticities (const char *name,
double wx, double wy,
double rx, double ry,
@@ -575,6 +618,7 @@ const Babl * babl_space_from_chromaticities (const char *name,
* Creates a Babl TRC for a specific gamma value, it will be given
* a name that is a short string representation of the value.
*/
+BABL_API
const Babl * babl_trc_gamma (double gamma);
/**
@@ -583,6 +627,7 @@ const Babl * babl_trc_gamma (double gamma);
* Look up a TRC by name, "sRGB" and "linear" are recognized
* strings in a stock babl configuration.
*/
+BABL_API
const Babl * babl_trc (const char *name);
/**
@@ -590,6 +635,7 @@ const Babl * babl_trc (const char *name);
*
* Creates a variant of an existing space with different trc.
*/
+BABL_API
const Babl *babl_space_with_trc (const Babl *space, const Babl *trc);
/**
@@ -612,6 +658,7 @@ const Babl *babl_space_with_trc (const Babl *space, const Babl *trc);
* query the chromaticities of white point and primaries as well as trcs
* used for r g a nd b, all arguments are optional (can be %NULL).
*/
+BABL_API
void babl_space_get (const Babl *space,
double *xw, double *yw,
double *xr, double *yr,
@@ -630,6 +677,7 @@ void babl_space_get (const Babl *space,
*
* Retrieve the relevant RGB luminance constants for a babl space.
*/
+BABL_API
void
babl_space_get_rgb_luminance (const Babl *space,
double *red_luminance,
@@ -642,6 +690,7 @@ babl_space_get_rgb_luminance (const Babl *space,
* Returns: 0 if the name of the model in babl does not correspond to the
* provided model name.
*/
+BABL_API
int babl_model_is (const Babl *babl, const char *model_name);
#define babl_model_is(babl,model) (babl&&(babl)==babl_model_with_space(model,babl))
@@ -659,6 +708,7 @@ int babl_model_is (const Babl *babl, const char *model_name);
*
* Returns: pointer to ICC profile data.
*/
+BABL_API
const char *babl_space_get_icc (const Babl *babl, int *length);
/**
@@ -686,6 +736,7 @@ const char *babl_space_get_icc (const Babl *babl, int *length);
* adapted 3x3 matrix and associated CIE XYZ whitepoint, as possibly read from
* an ICC profile.
*/
+BABL_API
const Babl *
babl_space_from_rgbxyz_matrix (const char *name,
double wx, double wy, double wz,
@@ -701,9 +752,12 @@ babl_space_from_rgbxyz_matrix (const char *name,
*
* Returns the components and data type, without space suffix.
*/
+BABL_API
const char * babl_format_get_encoding (const Babl *babl);
+BABL_API
int babl_space_is_cmyk (const Babl *space);
+BABL_API
int babl_space_is_gray (const Babl *space);
/* values below this are stored associated with this value, it should also be
diff --git a/babl/meson.build b/babl/meson.build
index c86fbacc5..ac3636e3b 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -32,6 +32,7 @@ babl_c_args = [
if cc.get_id() == 'msvc'
bablExtraInclude = include_directories('dirent')
babl_extra_sources = [ 'dirent/dirent.c' ]
+ babl_c_args += '-DBABL_IS_BEING_COMPILED'
else
bablExtraInclude = []
babl_extra_sources = []
@@ -51,7 +52,7 @@ if cc.get_id() != 'msvc'
babl_link_args += '-Wl,--no-undefined'
endif
else
- babl_link_args= []
+ babl_link_args = []
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]