From fdfff9c0f11d607344f52099dcd9f775b892499b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 10 Oct 2019 20:06:07 +0200 Subject: [PATCH] Add support for GCC hidden visibility. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit 19b0ebb41636aaaadcaa189812f027013b0511b5) --- src/carddav.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/carddav.h b/src/carddav.h index fbd303a..f583ec9 100644 --- a/src/carddav.h +++ b/src/carddav.h @@ -46,6 +46,18 @@ #include + +#if defined(__KDE_HAVE_GCC_VISIBILITY) || defined(G_HAVE_GCC_VISIBILITY) +#define CARDDAV_NO_EXPORT __attribute__ ((visibility("hidden"))) +#define CARDDAV_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_WIN32) +#define CARDDAV_NO_EXPORT +#define CARDDAV_EXPORT __declspec(dllexport) +#else +#define CARDDAV_NO_EXPORT +#define CARDDAV_EXPORT +#endif + /* For debug purposes */ /** * @typedef struct debug_curl @@ -165,6 +177,7 @@ typedef enum { * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_add_object(const char* object, const char* URL, runtime_info* info); @@ -179,6 +192,7 @@ CARDDAV_RESPONSE carddav_add_object(const char* object, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_delete_object(const char* object, const char* URL, runtime_info* info); @@ -193,6 +207,7 @@ CARDDAV_RESPONSE carddav_delete_object(const char* object, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_delete_object_by_uri(const char* object, const char* URL, runtime_info* info); @@ -207,6 +222,7 @@ CARDDAV_RESPONSE carddav_delete_object_by_uri(const char* object, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_modify_object(const char* object, const char* URL, runtime_info* info); @@ -221,6 +237,7 @@ CARDDAV_RESPONSE carddav_modify_object(const char* object, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_modify_object_by_uri(const char* object, const char* URL, runtime_info* info); @@ -237,6 +254,7 @@ CARDDAV_RESPONSE carddav_modify_object_by_uri(const char* object, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_get_object(response* result, time_t start, time_t end, @@ -253,6 +271,7 @@ CARDDAV_RESPONSE carddav_get_object(response* result, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_getall_object(response* result, const char* URL, runtime_info* info); @@ -268,6 +287,7 @@ CARDDAV_RESPONSE carddav_getall_object(response* result, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_getall_object_by_uri(response* result, const char* URL, runtime_info* info); @@ -282,6 +302,7 @@ CARDDAV_RESPONSE carddav_getall_object_by_uri(response* result, * @param info Pointer to a runtime_info structure. @see runtime_info * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_get_displayname(response* result, const char* URL, runtime_info* info); @@ -295,6 +316,7 @@ CARDDAV_RESPONSE carddav_get_displayname(response* result, * @result 0 (zero) means no CardDAV support, otherwise CardDAV support * detechted. */ +CARDDAV_EXPORT int carddav_enabled_resource(const char* URL, runtime_info* info); /** @@ -310,6 +332,7 @@ int carddav_enabled_resource(const char* URL, runtime_info* info); * See (RFC1738). * @return Ok, FORBIDDEN, or CONFLICT. @see CARDDAV_RESPONSE */ +CARDDAV_EXPORT CARDDAV_RESPONSE carddav_get_freebusy(response *result, time_t start, time_t end, @@ -327,6 +350,7 @@ CARDDAV_RESPONSE carddav_get_freebusy(response *result, * @return An initialized carddav_error pointer to memory where error * messages can be found from the last call to the library. */ +CARDDAV_EXPORT carddav_error* carddav_get_error(carddav_error* lib_error); /** @@ -335,6 +359,7 @@ carddav_error* carddav_get_error(carddav_error* lib_error); * Caller provides a pointer to a local carddav_error structure. * @param lib_error A pointer to a struct _carddav_error. @see _carddav_error */ +CARDDAV_EXPORT void carddav_free_error(carddav_error* lib_error); /* Setting various options in library */ @@ -344,6 +369,7 @@ void carddav_free_error(carddav_error* lib_error); * Function which supports sending various options inside the library. * @param curl_options A struct debug_curl. See debug_curl. */ +CARDDAV_EXPORT void carddav_set_options(debug_curl curl_options); /** @@ -354,12 +380,14 @@ void carddav_set_options(debug_curl curl_options); * @param info Pointer to a runtime_info structure. @see runtime_info * @result A list of available options or NULL in case of any error. */ +CARDDAV_EXPORT char** carddav_get_server_options(const char* URL, runtime_info* info); /** * Function for getting an initialized runtime_info structure * @return runtime_info. @see runtime_info */ +CARDDAV_EXPORT runtime_info* carddav_get_runtime_info(); /** @@ -368,12 +396,14 @@ runtime_info* carddav_get_runtime_info(); * @param info Address to a pointer to a runtime_info structure. @see * runtime_info */ +CARDDAV_EXPORT void carddav_free_runtime_info(runtime_info** info); /** * Function for getting an initialized response structure * @return response. @see _response */ +CARDDAV_EXPORT response* carddav_get_response(); /** @@ -382,6 +412,7 @@ response* carddav_get_response(); * @param info Address to a pointer to a response structure. @see * _response */ +CARDDAV_EXPORT void carddav_free_response(response** info); #endif