From 0d7ed811fed30a2eabb1cc8a446155936bc8c5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Mon, 5 Nov 2007 02:04:10 +0000 Subject: [PATCH] Use separate DLL export macro for libtag_c and use the right DEFINE_SYMBOL. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@732908 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- bindings/c/CMakeLists.txt | 6 +++- bindings/c/tag_c.h | 66 ++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index 526fafb7..2cea05b3 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -36,7 +36,11 @@ IF(HAVE_CRUN_LIB) TARGET_LINK_LIBRARIES(tag_c Crun) ENDIF(HAVE_CRUN_LIB) -SET_TARGET_PROPERTIES(tag_c PROPERTIES VERSION 0.0.0 SOVERSION 0 ) +SET_TARGET_PROPERTIES(tag_c PROPERTIES + VERSION 0.0.0 + SOVERSION 0 + DEFINE_SYMBOL MAKE_TAGLIB_C_LIB + ) INSTALL(TARGETS tag_c LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin diff --git a/bindings/c/tag_c.h b/bindings/c/tag_c.h index fff196a2..7e83a3a9 100644 --- a/bindings/c/tag_c.h +++ b/bindings/c/tag_c.h @@ -29,7 +29,15 @@ extern "C" { #endif -#include "taglib_export.h" +#if defined(_WIN32) || defined(_WIN64) +#ifdef MAKE_TAGLIB_C_LIB +#define TAGLIB_C_EXPORT __declspec(dllexport) +#else +#define TAGLIB_C_EXPORT __declspec(dllimport) +#endif +#else +#define TAGLIB_C_EXPORT +#endif #ifndef BOOL #define BOOL int @@ -59,7 +67,7 @@ typedef struct { int dummy; } TagLib_AudioProperties; * However, it may be desirable for TagLib to operate on Latin1 (ISO-8859-1) * strings in which case this should be set to FALSE. */ -TAGLIB_EXPORT void taglib_set_strings_unicode(BOOL unicode); +TAGLIB_C_EXPORT void taglib_set_strings_unicode(BOOL unicode); /*! * TagLib can keep track of strings that are created when outputting tag values @@ -67,7 +75,7 @@ TAGLIB_EXPORT void taglib_set_strings_unicode(BOOL unicode); * However if you wish to do more fine grained management of strings, you can do * so by setting \a management to FALSE. */ -TAGLIB_EXPORT void taglib_set_string_management_enabled(BOOL management); +TAGLIB_C_EXPORT void taglib_set_string_management_enabled(BOOL management); /******************************************************************************* * File API @@ -88,35 +96,35 @@ typedef enum { * \returns NULL if the file type cannot be determined or the file cannot * be opened. */ -TAGLIB_EXPORT TagLib_File *taglib_file_new(const char *filename); +TAGLIB_C_EXPORT TagLib_File *taglib_file_new(const char *filename); /*! * Creates a TagLib file based on \a filename. Rather than attempting to guess * the type, it will use the one specified by \a type. */ -TAGLIB_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type); +TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type); /*! * Frees and closes the file. */ -TAGLIB_EXPORT void taglib_file_free(TagLib_File *file); +TAGLIB_C_EXPORT void taglib_file_free(TagLib_File *file); /*! * Returns a pointer to the tag associated with this file. This will be freed * automatically when the file is freed. */ -TAGLIB_EXPORT TagLib_Tag *taglib_file_tag(const TagLib_File *file); +TAGLIB_C_EXPORT TagLib_Tag *taglib_file_tag(const TagLib_File *file); /*! * Returns a pointer to the the audio properties associated with this file. This * will be freed automatically when the file is freed. */ -TAGLIB_EXPORT const TagLib_AudioProperties *taglib_file_audioproperties(const TagLib_File *file); +TAGLIB_C_EXPORT const TagLib_AudioProperties *taglib_file_audioproperties(const TagLib_File *file); /*! * Saves the \a file to disk. */ -TAGLIB_EXPORT BOOL taglib_file_save(TagLib_File *file); +TAGLIB_C_EXPORT BOOL taglib_file_save(TagLib_File *file); /****************************************************************************** * Tag API @@ -128,7 +136,7 @@ TAGLIB_EXPORT BOOL taglib_file_save(TagLib_File *file); * \note By default this string should be UTF8 encoded and its memory should be * freed using taglib_tag_free_strings(). */ -TAGLIB_EXPORT char *taglib_tag_title(const TagLib_Tag *tag); +TAGLIB_C_EXPORT char *taglib_tag_title(const TagLib_Tag *tag); /*! * Returns a string with this tag's artist. @@ -136,7 +144,7 @@ TAGLIB_EXPORT char *taglib_tag_title(const TagLib_Tag *tag); * \note By default this string should be UTF8 encoded and its memory should be * freed using taglib_tag_free_strings(). */ -TAGLIB_EXPORT char *taglib_tag_artist(const TagLib_Tag *tag); +TAGLIB_C_EXPORT char *taglib_tag_artist(const TagLib_Tag *tag); /*! * Returns a string with this tag's album name. @@ -144,7 +152,7 @@ TAGLIB_EXPORT char *taglib_tag_artist(const TagLib_Tag *tag); * \note By default this string should be UTF8 encoded and its memory should be * freed using taglib_tag_free_strings(). */ -TAGLIB_EXPORT char *taglib_tag_album(const TagLib_Tag *tag); +TAGLIB_C_EXPORT char *taglib_tag_album(const TagLib_Tag *tag); /*! * Returns a string with this tag's comment. @@ -152,7 +160,7 @@ TAGLIB_EXPORT char *taglib_tag_album(const TagLib_Tag *tag); * \note By default this string should be UTF8 encoded and its memory should be * freed using taglib_tag_free_strings(). */ -TAGLIB_EXPORT char *taglib_tag_comment(const TagLib_Tag *tag); +TAGLIB_C_EXPORT char *taglib_tag_comment(const TagLib_Tag *tag); /*! * Returns a string with this tag's genre. @@ -160,67 +168,67 @@ TAGLIB_EXPORT char *taglib_tag_comment(const TagLib_Tag *tag); * \note By default this string should be UTF8 encoded and its memory should be * freed using taglib_tag_free_strings(). */ -TAGLIB_EXPORT char *taglib_tag_genre(const TagLib_Tag *tag); +TAGLIB_C_EXPORT char *taglib_tag_genre(const TagLib_Tag *tag); /*! * Returns the tag's year or 0 if year is not set. */ -TAGLIB_EXPORT unsigned int taglib_tag_year(const TagLib_Tag *tag); +TAGLIB_C_EXPORT unsigned int taglib_tag_year(const TagLib_Tag *tag); /*! * Returns the tag's track number or 0 if track number is not set. */ -TAGLIB_EXPORT unsigned int taglib_tag_track(const TagLib_Tag *tag); +TAGLIB_C_EXPORT unsigned int taglib_tag_track(const TagLib_Tag *tag); /*! * Sets the tag's title. * * \note By default this string should be UTF8 encoded. */ -TAGLIB_EXPORT void taglib_tag_set_title(TagLib_Tag *tag, const char *title); +TAGLIB_C_EXPORT void taglib_tag_set_title(TagLib_Tag *tag, const char *title); /*! * Sets the tag's artist. * * \note By default this string should be UTF8 encoded. */ -TAGLIB_EXPORT void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist); +TAGLIB_C_EXPORT void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist); /*! * Sets the tag's album. * * \note By default this string should be UTF8 encoded. */ -TAGLIB_EXPORT void taglib_tag_set_album(TagLib_Tag *tag, const char *album); +TAGLIB_C_EXPORT void taglib_tag_set_album(TagLib_Tag *tag, const char *album); /*! * Sets the tag's comment. * * \note By default this string should be UTF8 encoded. */ -TAGLIB_EXPORT void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment); +TAGLIB_C_EXPORT void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment); /*! * Sets the tag's genre. * * \note By default this string should be UTF8 encoded. */ -TAGLIB_EXPORT void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre); +TAGLIB_C_EXPORT void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre); /*! * Sets the tag's year. 0 indicates that this field should be cleared. */ -TAGLIB_EXPORT void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year); +TAGLIB_C_EXPORT void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year); /*! * Sets the tag's track number. 0 indicates that this field should be cleared. */ -TAGLIB_EXPORT void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track); +TAGLIB_C_EXPORT void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track); /*! * Frees all of the strings that have been created by the tag. */ -TAGLIB_EXPORT void taglib_tag_free_strings(void); +TAGLIB_C_EXPORT void taglib_tag_free_strings(void); /****************************************************************************** * Audio Properties API @@ -229,22 +237,22 @@ TAGLIB_EXPORT void taglib_tag_free_strings(void); /*! * Returns the length of the file in seconds. */ -TAGLIB_EXPORT int taglib_audioproperties_length(const TagLib_AudioProperties *audioProperties); +TAGLIB_C_EXPORT int taglib_audioproperties_length(const TagLib_AudioProperties *audioProperties); /*! * Returns the bitrate of the file in kb/s. */ -TAGLIB_EXPORT int taglib_audioproperties_bitrate(const TagLib_AudioProperties *audioProperties); +TAGLIB_C_EXPORT int taglib_audioproperties_bitrate(const TagLib_AudioProperties *audioProperties); /*! * Returns the sample rate of the file in Hz. */ -TAGLIB_EXPORT int taglib_audioproperties_samplerate(const TagLib_AudioProperties *audioProperties); +TAGLIB_C_EXPORT int taglib_audioproperties_samplerate(const TagLib_AudioProperties *audioProperties); /*! * Returns the number of channels in the audio stream. */ -TAGLIB_EXPORT int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties); +TAGLIB_C_EXPORT int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties); /******************************************************************************* * Special convenience ID3v2 functions @@ -261,7 +269,7 @@ typedef enum { * This sets the default encoding for ID3v2 frames that are written to tags. */ -TAGLIB_EXPORT void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding); +TAGLIB_C_EXPORT void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding); #ifdef __cplusplus }