commit cc21dfaff82f7d9970281c81a6136dbe8d277f1a
parent 5db3c08d248ba1800098462d6dd57b5942587feb
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 31 Dec 2013 23:07:26 -0800
Explicitly export symbols
Diffstat:
10 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -74,7 +74,7 @@ WLD_PACKAGE_LIBS ?= $(call pkgconfig,$(WLD_PACKAGES),libs,LIBS)
CLEAN_FILES += $(WLD_STATIC_OBJECTS) $(WLD_SHARED_OBJECTS)
-FINAL_CFLAGS = $(CFLAGS) -std=c99
+FINAL_CFLAGS = $(CFLAGS) -fvisibility=hidden -std=c99
FINAL_CPPFLAGS = $(CPPFLAGS) -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
# Warning/error flags
diff --git a/color.c b/color.c
@@ -811,6 +811,7 @@ static const struct named_color named_colors[] = {
{ "YellowGreen", 0xff9acd32 }
};
+EXPORT
bool wld_lookup_named_color(const char * name, uint32_t * color)
{
char * end;
diff --git a/drawable.c b/drawable.c
@@ -60,18 +60,21 @@ void default_copy_region(struct wld_drawable * src, struct wld_drawable * dst,
}
}
+EXPORT
void wld_fill_rectangle(struct wld_drawable * drawable, uint32_t color,
int32_t x, int32_t y, uint32_t width, uint32_t height)
{
drawable->interface->fill_rectangle(drawable, color, x, y, width, height);
}
+EXPORT
void wld_fill_region(struct wld_drawable * drawable, uint32_t color,
pixman_region32_t * region)
{
drawable->interface->fill_region(drawable, color, region);
}
+EXPORT
void wld_copy_rectangle(struct wld_drawable * src, struct wld_drawable * dst,
int32_t src_x, int32_t src_y,
int32_t dst_x, int32_t dst_y,
@@ -82,6 +85,7 @@ void wld_copy_rectangle(struct wld_drawable * src, struct wld_drawable * dst,
width, height);
}
+EXPORT
void wld_copy_region(struct wld_drawable * src, struct wld_drawable * dst,
pixman_region32_t * region, int32_t dst_x, int32_t dst_y)
{
@@ -89,6 +93,7 @@ void wld_copy_region(struct wld_drawable * src, struct wld_drawable * dst,
dst->interface->copy_region(src, dst, region, dst_x, dst_y);
}
+EXPORT
void wld_draw_text_utf8_n(struct wld_drawable * drawable,
struct wld_font * font_base, uint32_t color,
int32_t x, int32_t y,
@@ -101,21 +106,25 @@ void wld_draw_text_utf8_n(struct wld_drawable * drawable,
text, length, extents);
}
+EXPORT
void wld_destroy_drawable(struct wld_drawable * drawable)
{
drawable->interface->destroy(drawable);
}
+EXPORT
void wld_write(struct wld_drawable * drawable, const void * data, size_t size)
{
drawable->interface->write(drawable, data, size);
}
+EXPORT
pixman_image_t * wld_map(struct wld_drawable * drawable)
{
return drawable->interface->map(drawable);
}
+EXPORT
void wld_flush(struct wld_drawable * drawable)
{
drawable->interface->flush(drawable);
diff --git a/drm.c b/drm.c
@@ -84,6 +84,7 @@ void drm_finalize_context(struct wld_drm_context * drm)
drm->interface->destroy_context(drm->context);
}
+EXPORT
struct wld_drm_context * wld_drm_create_context(int fd)
{
struct wld_drm_context * drm;
@@ -102,17 +103,20 @@ struct wld_drm_context * wld_drm_create_context(int fd)
return NULL;
}
+EXPORT
void wld_drm_destroy_context(struct wld_drm_context * drm)
{
drm_finalize_context(drm);
free(drm);
}
+EXPORT
bool wld_drm_is_dumb(struct wld_drm_context * drm)
{
return drm->interface == &dumb_drm;
}
+EXPORT
struct wld_drawable * wld_drm_create_drawable(struct wld_drm_context * drm,
uint32_t width, uint32_t height,
uint32_t format)
@@ -120,6 +124,7 @@ struct wld_drawable * wld_drm_create_drawable(struct wld_drm_context * drm,
return drm->interface->create_drawable(drm->context, width, height, format);
}
+EXPORT
struct wld_drawable * wld_drm_import(struct wld_drm_context * drm,
uint32_t width, uint32_t height,
uint32_t format,
@@ -129,6 +134,7 @@ struct wld_drawable * wld_drm_import(struct wld_drm_context * drm,
prime_fd, pitch);
}
+EXPORT
struct wld_drawable * wld_drm_import_gem(struct wld_drm_context * drm,
uint32_t width, uint32_t height,
uint32_t format,
@@ -138,11 +144,13 @@ struct wld_drawable * wld_drm_import_gem(struct wld_drm_context * drm,
gem_name, pitch);
}
+EXPORT
int wld_drm_export(struct wld_drawable * drawable)
{
return ((struct drm_draw_interface *) drawable->interface)->export(drawable);
}
+EXPORT
uint32_t wld_drm_get_handle(struct wld_drawable * drawable)
{
return ((struct drm_draw_interface *) drawable->interface)->get_handle(drawable);
diff --git a/font.c b/font.c
@@ -25,6 +25,7 @@
#include <fontconfig/fcfreetype.h>
+EXPORT
struct wld_font_context * wld_font_create_context()
{
struct wld_font_context * context;
@@ -49,12 +50,14 @@ struct wld_font_context * wld_font_create_context()
return NULL;
}
+EXPORT
void wld_font_destroy_context(struct wld_font_context * context)
{
FT_Done_FreeType(context->library);
free(context);
}
+EXPORT
struct wld_font * wld_font_open_name(struct wld_font_context * context,
const char * name)
{
@@ -75,6 +78,7 @@ struct wld_font * wld_font_open_name(struct wld_font_context * context,
return wld_font_open_pattern(context, match);
}
+EXPORT
struct wld_font * wld_font_open_pattern(struct wld_font_context * context,
FcPattern * match)
{
@@ -150,6 +154,7 @@ struct wld_font * wld_font_open_pattern(struct wld_font_context * context,
return NULL;
}
+EXPORT
void wld_font_close(struct wld_font * font_base)
{
struct font * font = (void *) font_base;
@@ -192,6 +197,7 @@ bool font_ensure_glyph(struct font * font, FT_UInt glyph_index)
return false;
}
+EXPORT
bool wld_font_ensure_char(struct wld_font * font_base, uint32_t character)
{
struct font * font = (void *) font_base;
@@ -202,6 +208,7 @@ bool wld_font_ensure_char(struct wld_font * font_base, uint32_t character)
return font_ensure_glyph(font, glyph_index);
}
+EXPORT
void wld_font_text_extents_utf8_n(struct wld_font * font_base,
const char * text, int32_t length,
struct wld_extents * extents)
diff --git a/pixman.c b/pixman.c
@@ -74,6 +74,7 @@ const struct wld_draw_interface pixman_draw = {
.destroy = &pixman_destroy
};
+EXPORT
struct wld_pixman_context * wld_pixman_create_context()
{
struct wld_pixman_context * context;
@@ -92,6 +93,7 @@ struct wld_pixman_context * wld_pixman_create_context()
return NULL;
}
+EXPORT
void wld_pixman_destroy_context(struct wld_pixman_context * context)
{
pixman_glyph_cache_destroy(context->glyph_cache);
@@ -117,6 +119,7 @@ bool pixman_initialize_drawable
return drawable->image != NULL;
}
+EXPORT
struct wld_drawable * wld_pixman_create_drawable
(struct wld_pixman_context * context, uint32_t width, uint32_t height,
void * data, uint32_t pitch, uint32_t format)
diff --git a/wayland-drm.c b/wayland-drm.c
@@ -82,6 +82,7 @@ const static struct wl_drm_listener drm_listener = {
.capabilities = &drm_capabilities
};
+EXPORT
struct wld_wayland_drm_context * wld_wayland_drm_create_context
(struct wl_display * display, struct wl_event_queue * queue)
{
@@ -161,6 +162,7 @@ struct wld_wayland_drm_context * wld_wayland_drm_create_context
return NULL;
}
+EXPORT
void wld_wayland_drm_destroy_context(struct wld_wayland_drm_context * drm)
{
drm_finalize_context(&drm->context);
@@ -172,6 +174,7 @@ void wld_wayland_drm_destroy_context(struct wld_wayland_drm_context * drm)
free(drm);
}
+EXPORT
bool wld_wayland_drm_has_format(struct wld_wayland_drm_context * drm,
uint32_t format)
{
@@ -186,11 +189,13 @@ bool wld_wayland_drm_has_format(struct wld_wayland_drm_context * drm,
return false;
}
+EXPORT
int wld_wayland_drm_get_fd(struct wld_wayland_drm_context * drm)
{
return drm->authenticated ? drm->fd : -1;
}
+EXPORT
struct wld_drawable * wld_wayland_drm_create_drawable
(struct wld_wayland_drm_context * drm, uint32_t width, uint32_t height,
uint32_t format, struct wl_buffer ** buffer)
diff --git a/wayland-shm.c b/wayland-shm.c
@@ -82,6 +82,7 @@ static inline uint32_t wayland_format(uint32_t format)
}
}
+EXPORT
struct wld_shm_context * wld_shm_create_context(struct wl_display * display,
struct wl_event_queue * queue)
{
@@ -133,6 +134,7 @@ struct wld_shm_context * wld_shm_create_context(struct wl_display * display,
return NULL;
}
+EXPORT
void wld_shm_destroy_context(struct wld_shm_context * shm)
{
wld_pixman_destroy_context(shm->pixman_context);
@@ -143,6 +145,7 @@ void wld_shm_destroy_context(struct wld_shm_context * shm)
free(shm);
}
+EXPORT
bool wld_shm_has_format(struct wld_shm_context * shm, uint32_t format)
{
uint32_t * supported_format;
@@ -156,6 +159,7 @@ bool wld_shm_has_format(struct wld_shm_context * shm, uint32_t format)
return false;
}
+EXPORT
struct wld_drawable * wld_shm_create_drawable(struct wld_shm_context * shm,
uint32_t width, uint32_t height,
uint32_t format,
diff --git a/wayland.c b/wayland.c
@@ -111,6 +111,7 @@ const static struct wld_wayland_interface * interfaces[] = {
#endif
};
+EXPORT
struct wld_wayland_context * wld_wayland_create_context
(struct wl_display * display, enum wld_wayland_interface_id id, ...)
{
@@ -187,12 +188,14 @@ struct wld_wayland_context * wld_wayland_create_context
return NULL;
}
+EXPORT
void wld_wayland_destroy_context(struct wld_wayland_context * wayland)
{
wayland->interface->destroy_context(wayland->context);
free(wayland);
}
+EXPORT
struct wld_drawable * wld_wayland_create_drawable
(struct wld_wayland_context * context, struct wl_surface * surface,
uint32_t width, uint32_t height, uint32_t format, uint32_t damage_flags)
@@ -244,6 +247,7 @@ struct wld_drawable * wld_wayland_create_drawable
return NULL;
}
+EXPORT
void wld_wayland_drawable_set_damage_tracking(struct wld_drawable * drawable,
uint32_t flags)
{
diff --git a/wld-private.h b/wld-private.h
@@ -44,6 +44,8 @@
# define DEBUG(format, ...)
#endif
+#define EXPORT __attribute__((visibility("default")))
+
struct wld_font_context
{
FT_Library library;