diff --git a/README.md b/README.md index 53da30b..527eb92 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,16 @@ you link in the C++ standard library: gcc -o test_app test_app.c -lmusicbrainz5 -lm -lstdc++ + +Generating the libmusicbrainz5 Visual Studio solution using CMake GUI +--------------------------------------------------------------------- +1. Download [Neon] (http://www.webdav.org/neon/) and extract it. +2. In Visual Studio command prompt (not regular cmd.exe), navigate to the Neon extract folder and execute: *nmake /f neon.mak* +3. Point CMake at the libmusicbrainz source. Specify a build location and click Configure. Specify the appropriate generator. +4. CMake should complain that it cannot find Neon. Set *NEON_INCLUDE_DIR* to *{neon_extract}\src* and *NEON_LIBRARIES* to *{neon_extract}\libneon.lib* +5. Click Configure again and then Generate. This will have generated a VS solution for you which should build without issue. + + Contact ------- diff --git a/include/musicbrainz5/Alias.h b/include/musicbrainz5/Alias.h index f6c2e35..16e7d01 100644 --- a/include/musicbrainz5/Alias.h +++ b/include/musicbrainz5/Alias.h @@ -28,6 +28,8 @@ #include #include +#include "musicbrainz5/defines.h" + #include "musicbrainz5/Entity.h" #include "musicbrainz5/xmlParser.h" @@ -36,7 +38,7 @@ namespace MusicBrainz5 { class CAliasPrivate; - class CAlias: public CEntity + class MB_API CAlias: public CEntity { public: CAlias(const XMLNode& Node); diff --git a/include/musicbrainz5/Annotation.h b/include/musicbrainz5/Annotation.h index 2cfb1e7..ea0d372 100644 --- a/include/musicbrainz5/Annotation.h +++ b/include/musicbrainz5/Annotation.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CAnnotationPrivate; - class CAnnotation: public CEntity + class MB_API CAnnotation: public CEntity { public: CAnnotation(const XMLNode& Node); diff --git a/include/musicbrainz5/Artist.h b/include/musicbrainz5/Artist.h index 915464c..8c8d728 100644 --- a/include/musicbrainz5/Artist.h +++ b/include/musicbrainz5/Artist.h @@ -49,7 +49,7 @@ namespace MusicBrainz5 class CRating; class CUserRating; - class CArtist: public CEntity + class MB_API CArtist: public CEntity { public: CArtist(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/ArtistCredit.h b/include/musicbrainz5/ArtistCredit.h index dd579cc..5a09aec 100644 --- a/include/musicbrainz5/ArtistCredit.h +++ b/include/musicbrainz5/ArtistCredit.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CArtistCreditPrivate; - class CArtistCredit: public CEntity + class MB_API CArtistCredit: public CEntity { public: CArtistCredit(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Attribute.h b/include/musicbrainz5/Attribute.h index 98357da..31b082a 100644 --- a/include/musicbrainz5/Attribute.h +++ b/include/musicbrainz5/Attribute.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CAttributePrivate; - class CAttribute: public CEntity + class MB_API CAttribute: public CEntity { public: CAttribute(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/CDStub.h b/include/musicbrainz5/CDStub.h index dfbe01f..7f27662 100644 --- a/include/musicbrainz5/CDStub.h +++ b/include/musicbrainz5/CDStub.h @@ -37,7 +37,7 @@ namespace MusicBrainz5 { class CCDStubPrivate; - class CCDStub: public CEntity + class MB_API CCDStub: public CEntity { public: CCDStub(const XMLNode& Node); diff --git a/include/musicbrainz5/Collection.h b/include/musicbrainz5/Collection.h index 96a03a7..3907af3 100644 --- a/include/musicbrainz5/Collection.h +++ b/include/musicbrainz5/Collection.h @@ -34,7 +34,7 @@ namespace MusicBrainz5 { class CCollectionPrivate; - class CCollection: public CEntity + class MB_API CCollection: public CEntity { public: CCollection(const XMLNode& Node); diff --git a/include/musicbrainz5/Disc.h b/include/musicbrainz5/Disc.h index aeeb504..f18ea5e 100644 --- a/include/musicbrainz5/Disc.h +++ b/include/musicbrainz5/Disc.h @@ -39,7 +39,7 @@ namespace MusicBrainz5 { class CDiscPrivate; - class CDisc: public CEntity + class MB_API CDisc: public CEntity { public: CDisc(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Entity.h b/include/musicbrainz5/Entity.h index 0d72722..fa3df3d 100644 --- a/include/musicbrainz5/Entity.h +++ b/include/musicbrainz5/Entity.h @@ -30,15 +30,17 @@ #include #include +#include "musicbrainz5/defines.h" #include "musicbrainz5/xmlParser.h" + namespace MusicBrainz5 { class CEntityPrivate; class CRelationListList; - class CEntity + class MB_API CEntity { public: CEntity(); @@ -111,6 +113,6 @@ namespace MusicBrainz5 }; } -std::ostream& operator << (std::ostream& os, const MusicBrainz5::CEntity& Entity); +MB_API std::ostream& operator << (std::ostream& os, const MusicBrainz5::CEntity& Entity); #endif diff --git a/include/musicbrainz5/FreeDBDisc.h b/include/musicbrainz5/FreeDBDisc.h index a52e86e..cab974b 100644 --- a/include/musicbrainz5/FreeDBDisc.h +++ b/include/musicbrainz5/FreeDBDisc.h @@ -37,7 +37,7 @@ namespace MusicBrainz5 { class CFreeDBDiscPrivate; - class CFreeDBDisc: public CEntity + class MB_API CFreeDBDisc: public CEntity { public: CFreeDBDisc(const XMLNode& Node); diff --git a/include/musicbrainz5/HTTPFetch.h b/include/musicbrainz5/HTTPFetch.h index 7ef7194..05fa651 100644 --- a/include/musicbrainz5/HTTPFetch.h +++ b/include/musicbrainz5/HTTPFetch.h @@ -32,7 +32,7 @@ namespace MusicBrainz5 { class CHTTPFetchPrivate; - class CExceptionBase: public std::exception + class MB_API CExceptionBase: public std::exception { public: CExceptionBase(const std::string& ErrorMessage, const std::string& Exception) @@ -59,7 +59,7 @@ namespace MusicBrainz5 * Exception thrown when an error occurs connecting to web service */ - class CConnectionError: public CExceptionBase + class MB_API CConnectionError: public CExceptionBase { public: CConnectionError(const std::string& ErrorMessage) @@ -72,7 +72,7 @@ namespace MusicBrainz5 * Exception thrown when a connection to the web service times out */ - class CTimeoutError: public CExceptionBase + class MB_API CTimeoutError: public CExceptionBase { public: CTimeoutError(const std::string& ErrorMessage) @@ -85,7 +85,7 @@ namespace MusicBrainz5 * Exception thrown when an authentication error occurs */ - class CAuthenticationError: public CExceptionBase + class MB_API CAuthenticationError: public CExceptionBase { public: CAuthenticationError(const std::string& ErrorMessage) @@ -98,7 +98,7 @@ namespace MusicBrainz5 * Exception thrown when an error occurs fetching data */ - class CFetchError: public CExceptionBase + class MB_API CFetchError: public CExceptionBase { public: CFetchError(const std::string& ErrorMessage) @@ -111,7 +111,7 @@ namespace MusicBrainz5 * Exception thrown when an invalid request is made */ - class CRequestError: public CExceptionBase + class MB_API CRequestError: public CExceptionBase { public: CRequestError(const std::string& ErrorMessage) @@ -124,7 +124,7 @@ namespace MusicBrainz5 * Exception thrown when the requested resource is not found */ - class CResourceNotFoundError: public CExceptionBase + class MB_API CResourceNotFoundError: public CExceptionBase { public: CResourceNotFoundError(const std::string& ErrorMessage) @@ -139,7 +139,7 @@ namespace MusicBrainz5 * Object to be used to make HTTP requests * */ - class CHTTPFetch + class MB_API CHTTPFetch { public: /** diff --git a/include/musicbrainz5/IPI.h b/include/musicbrainz5/IPI.h index 4ee360f..8eaf23d 100644 --- a/include/musicbrainz5/IPI.h +++ b/include/musicbrainz5/IPI.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CIPIPrivate; - class CIPI: public CEntity + class MB_API CIPI: public CEntity { public: CIPI(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/ISRC.h b/include/musicbrainz5/ISRC.h index 55b02bc..6e38bde 100644 --- a/include/musicbrainz5/ISRC.h +++ b/include/musicbrainz5/ISRC.h @@ -34,7 +34,7 @@ namespace MusicBrainz5 { class CISRCPrivate; - class CISRC: public CEntity + class MB_API CISRC: public CEntity { public: CISRC(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/ISWC.h b/include/musicbrainz5/ISWC.h index eca92e8..f16ef04 100644 --- a/include/musicbrainz5/ISWC.h +++ b/include/musicbrainz5/ISWC.h @@ -28,6 +28,8 @@ #include #include +#include "musicbrainz5/defines.h" + #include "musicbrainz5/Entity.h" #include "musicbrainz5/xmlParser.h" @@ -36,7 +38,7 @@ namespace MusicBrainz5 { class CISWCPrivate; - class CISWC: public CEntity + class MB_API CISWC: public CEntity { public: CISWC(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/ISWCList.h b/include/musicbrainz5/ISWCList.h index b0f130a..f57f6c6 100644 --- a/include/musicbrainz5/ISWCList.h +++ b/include/musicbrainz5/ISWCList.h @@ -32,12 +32,13 @@ #include "musicbrainz5/xmlParser.h" +#include "musicbrainz5/ISWC.h" + namespace MusicBrainz5 { - class CISWC; class CISWCListPrivate; - class CISWCList: public CListImpl + class MB_API CISWCList: public CListImpl { public: CISWCList(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Label.h b/include/musicbrainz5/Label.h index 6e712a8..dda69e9 100644 --- a/include/musicbrainz5/Label.h +++ b/include/musicbrainz5/Label.h @@ -46,7 +46,7 @@ namespace MusicBrainz5 class CRating; class CUserRating; - class CLabel: public CEntity + class MB_API CLabel: public CEntity { public: CLabel(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/LabelInfo.h b/include/musicbrainz5/LabelInfo.h index ee4d6a1..d725431 100644 --- a/include/musicbrainz5/LabelInfo.h +++ b/include/musicbrainz5/LabelInfo.h @@ -38,7 +38,7 @@ namespace MusicBrainz5 class CLabel; - class CLabelInfo: public CEntity + class MB_API CLabelInfo: public CEntity { public: CLabelInfo(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Lifespan.h b/include/musicbrainz5/Lifespan.h index 833efde..bd17e43 100644 --- a/include/musicbrainz5/Lifespan.h +++ b/include/musicbrainz5/Lifespan.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CLifespanPrivate; - class CLifespan: public CEntity + class MB_API CLifespan: public CEntity { public: CLifespan(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/List.h b/include/musicbrainz5/List.h index 2722fa9..8ab1d39 100644 --- a/include/musicbrainz5/List.h +++ b/include/musicbrainz5/List.h @@ -33,7 +33,7 @@ namespace MusicBrainz5 { class CListPrivate; - class CList: public CEntity + class MB_API CList: public CEntity { public: CList(); diff --git a/include/musicbrainz5/Medium.h b/include/musicbrainz5/Medium.h index e2ed715..d8943b4 100644 --- a/include/musicbrainz5/Medium.h +++ b/include/musicbrainz5/Medium.h @@ -38,7 +38,7 @@ namespace MusicBrainz5 { class CMediumPrivate; - class CMedium: public CEntity + class MB_API CMedium: public CEntity { public: CMedium(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/MediumList.h b/include/musicbrainz5/MediumList.h index 5f6b389..a86591f 100644 --- a/include/musicbrainz5/MediumList.h +++ b/include/musicbrainz5/MediumList.h @@ -32,12 +32,14 @@ #include "musicbrainz5/xmlParser.h" +#include "musicbrainz5/Medium.h" + + namespace MusicBrainz5 { - class CMedium; class CMediumListPrivate; - class CMediumList: public CListImpl + class MB_API CMediumList: public CListImpl { public: CMediumList(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Message.h b/include/musicbrainz5/Message.h index 866d141..48408d3 100644 --- a/include/musicbrainz5/Message.h +++ b/include/musicbrainz5/Message.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CMessagePrivate; - class CMessage: public CEntity + class MB_API CMessage: public CEntity { public: CMessage(const XMLNode& Node); diff --git a/include/musicbrainz5/Metadata.h b/include/musicbrainz5/Metadata.h index 37c6cbb..1d205a4 100644 --- a/include/musicbrainz5/Metadata.h +++ b/include/musicbrainz5/Metadata.h @@ -65,7 +65,7 @@ namespace MusicBrainz5 class CCDStub; class CMessage; - class CMetadata: public CEntity + class MB_API CMetadata: public CEntity { public: CMetadata(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/NameCredit.h b/include/musicbrainz5/NameCredit.h index f916eaf..caeab60 100644 --- a/include/musicbrainz5/NameCredit.h +++ b/include/musicbrainz5/NameCredit.h @@ -38,7 +38,7 @@ namespace MusicBrainz5 class CArtist; - class CNameCredit: public CEntity + class MB_API CNameCredit: public CEntity { public: CNameCredit(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/NonMBTrack.h b/include/musicbrainz5/NonMBTrack.h index 108f3db..db682f8 100644 --- a/include/musicbrainz5/NonMBTrack.h +++ b/include/musicbrainz5/NonMBTrack.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CNonMBTrackPrivate; - class CNonMBTrack: public CEntity + class MB_API CNonMBTrack: public CEntity { public: CNonMBTrack(const XMLNode& Node); diff --git a/include/musicbrainz5/PUID.h b/include/musicbrainz5/PUID.h index fd72834..1ca2822 100644 --- a/include/musicbrainz5/PUID.h +++ b/include/musicbrainz5/PUID.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CPUIDPrivate; - class CPUID: public CEntity + class MB_API CPUID: public CEntity { public: CPUID(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Query.h b/include/musicbrainz5/Query.h index 561338f..54531cb 100644 --- a/include/musicbrainz5/Query.h +++ b/include/musicbrainz5/Query.h @@ -181,7 +181,7 @@ namespace MusicBrainz5 * library. Users of the C library should take note of the documentation for each * individual function in mb5_c.h */ - class CQuery + class MB_API CQuery { public: typedef std::map tParamMap; diff --git a/include/musicbrainz5/Recording.h b/include/musicbrainz5/Recording.h index 5436001..2855cb3 100644 --- a/include/musicbrainz5/Recording.h +++ b/include/musicbrainz5/Recording.h @@ -51,7 +51,7 @@ namespace MusicBrainz5 class CRating; class CUserRating; - class CRecording: public CEntity + class MB_API CRecording: public CEntity { public: CRecording(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Relation.h b/include/musicbrainz5/Relation.h index 3f9b2d0..46addba 100644 --- a/include/musicbrainz5/Relation.h +++ b/include/musicbrainz5/Relation.h @@ -44,7 +44,7 @@ namespace MusicBrainz5 class CLabel; class CWork; - class CRelation: public CEntity + class MB_API CRelation: public CEntity { public: CRelation(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/RelationList.h b/include/musicbrainz5/RelationList.h index 0bd6ada..2504afa 100644 --- a/include/musicbrainz5/RelationList.h +++ b/include/musicbrainz5/RelationList.h @@ -32,12 +32,13 @@ #include "musicbrainz5/xmlParser.h" +#include "musicbrainz5/Relation.h" + namespace MusicBrainz5 { - class CRelation; class CRelationListPrivate; - class CRelationList: public CListImpl + class MB_API CRelationList: public CListImpl { public: CRelationList(const XMLNode& Node); diff --git a/include/musicbrainz5/RelationListList.h b/include/musicbrainz5/RelationListList.h index 35c140f..899c8fb 100644 --- a/include/musicbrainz5/RelationListList.h +++ b/include/musicbrainz5/RelationListList.h @@ -35,7 +35,7 @@ namespace MusicBrainz5 class CRelationList; - class CRelationListList + class MB_API CRelationListList { public: CRelationListList(); diff --git a/include/musicbrainz5/Release.h b/include/musicbrainz5/Release.h index 9a3d9ff..1ec1554 100644 --- a/include/musicbrainz5/Release.h +++ b/include/musicbrainz5/Release.h @@ -45,7 +45,7 @@ namespace MusicBrainz5 class CReleaseGroup; class CMedium; - class CRelease: public CEntity + class MB_API CRelease: public CEntity { public: CRelease(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/ReleaseGroup.h b/include/musicbrainz5/ReleaseGroup.h index 6bd46ca..7bc24db 100644 --- a/include/musicbrainz5/ReleaseGroup.h +++ b/include/musicbrainz5/ReleaseGroup.h @@ -46,7 +46,7 @@ namespace MusicBrainz5 class CUserRating; class CSecondaryType; - class CReleaseGroup: public CEntity + class MB_API CReleaseGroup: public CEntity { public: CReleaseGroup(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/SecondaryType.h b/include/musicbrainz5/SecondaryType.h index 705a7c9..6d3235c 100644 --- a/include/musicbrainz5/SecondaryType.h +++ b/include/musicbrainz5/SecondaryType.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CSecondaryTypePrivate; - class CSecondaryType: public CEntity + class MB_API CSecondaryType: public CEntity { public: CSecondaryType(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/SecondaryTypeList.h b/include/musicbrainz5/SecondaryTypeList.h index 6d67d41..1e953d2 100644 --- a/include/musicbrainz5/SecondaryTypeList.h +++ b/include/musicbrainz5/SecondaryTypeList.h @@ -32,12 +32,13 @@ #include "musicbrainz5/xmlParser.h" +#include "musicbrainz5/SecondaryType.h" + namespace MusicBrainz5 { - class CSecondaryType; class CSecondaryTypeListPrivate; - class CSecondaryTypeList: public CListImpl + class MB_API CSecondaryTypeList : public CListImpl { public: CSecondaryTypeList(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Tag.h b/include/musicbrainz5/Tag.h index 9c601d0..e9283cf 100644 --- a/include/musicbrainz5/Tag.h +++ b/include/musicbrainz5/Tag.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CTagPrivate; - class CTag: public CEntity + class MB_API CTag: public CEntity { public: CTag(const XMLNode& Node); diff --git a/include/musicbrainz5/TextRepresentation.h b/include/musicbrainz5/TextRepresentation.h index a0557a1..ab75d98 100644 --- a/include/musicbrainz5/TextRepresentation.h +++ b/include/musicbrainz5/TextRepresentation.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CTextRepresentationPrivate; - class CTextRepresentation: public CEntity + MB_API class CTextRepresentation: public CEntity { public: CTextRepresentation(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/Track.h b/include/musicbrainz5/Track.h index f707875..e52b928 100644 --- a/include/musicbrainz5/Track.h +++ b/include/musicbrainz5/Track.h @@ -39,7 +39,7 @@ namespace MusicBrainz5 class CRecording; class CArtistCredit; - class CTrack: public CEntity + class MB_API CTrack: public CEntity { public: CTrack(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/UserRating.h b/include/musicbrainz5/UserRating.h index cce7ecb..5f05fdb 100644 --- a/include/musicbrainz5/UserRating.h +++ b/include/musicbrainz5/UserRating.h @@ -35,7 +35,7 @@ namespace MusicBrainz5 { class CUserRatingPrivate; - class CUserRating: public CEntity + class MB_API CUserRating: public CEntity { public: CUserRating(const XMLNode& Node); diff --git a/include/musicbrainz5/UserTag.h b/include/musicbrainz5/UserTag.h index e56d095..2094a1f 100644 --- a/include/musicbrainz5/UserTag.h +++ b/include/musicbrainz5/UserTag.h @@ -36,7 +36,7 @@ namespace MusicBrainz5 { class CUserTagPrivate; - class CUserTag: public CEntity + class MB_API CUserTag: public CEntity { public: CUserTag(const XMLNode& Node); diff --git a/include/musicbrainz5/Work.h b/include/musicbrainz5/Work.h index 0189aec..c0f00e9 100644 --- a/include/musicbrainz5/Work.h +++ b/include/musicbrainz5/Work.h @@ -45,7 +45,7 @@ namespace MusicBrainz5 class CRating; class CUserRating; - class CWork: public CEntity + class MB_API CWork: public CEntity { public: CWork(const XMLNode& Node=XMLNode::emptyNode()); diff --git a/include/musicbrainz5/defines.h b/include/musicbrainz5/defines.h index 0112370..26a40d7 100644 --- a/include/musicbrainz5/defines.h +++ b/include/musicbrainz5/defines.h @@ -39,4 +39,28 @@ #endif + +#ifdef _MSC_VER +# pragma warning (disable : 4251) +#endif + +#if (defined(_WIN32) || defined(_WIN64)) +# ifdef MB_API_EXPORTS +# define MB_API __declspec(dllexport) +# else +# define MB_API __declspec(dllimport) +# endif +#else +# ifdef GCC_HASCLASSVISIBILITY +# define MB_API /*__attribute__ ((visibility("default")))*/ +# else +# define MB_API +# endif #endif + + + +#endif + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89ab63c..3ef12be 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,11 +26,22 @@ ADD_CUSTOM_TARGET(src_gen DEPENDS mb5_c.h) ADD_LIBRARY(musicbrainz5 SHARED ${_sources}) -SET_TARGET_PROPERTIES(musicbrainz5 PROPERTIES - VERSION ${musicbrainz5_VERSION} - SOVERSION ${musicbrainz5_SOVERSION} - DEFINE_SYMBOL MB_API_EXPORTS -) + +IF (MSVC) + SET_TARGET_PROPERTIES(musicbrainz5 PROPERTIES + VERSION ${musicbrainz5_VERSION} + SOVERSION ${musicbrainz5_SOVERSION} + DEFINE_SYMBOL "MB_API_EXPORTS;_DLL_EXPORTS_;_USE_XMLPARSER_DLL" + ) +ELSE (MSVC) + # CMake syntax is funny - this branch is actually equivalent to !MSVC + SET_TARGET_PROPERTIES(musicbrainz5 PROPERTIES + VERSION ${musicbrainz5_VERSION} + SOVERSION ${musicbrainz5_SOVERSION} + DEFINE_SYMBOL MB_API_EXPORTS + ) +ENDIF(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL Debug) SET_TARGET_PROPERTIES(musicbrainz5 PROPERTIES diff --git a/src/Query.cc b/src/Query.cc index d132ae7..aa5b25d 100644 --- a/src/Query.cc +++ b/src/Query.cc @@ -35,8 +35,12 @@ #include #include -#include -#include +#ifndef _MSC_VER + #include + #include +#else + #include +#endif #include @@ -46,6 +50,7 @@ #include "musicbrainz5/ReleaseList.h" #include "musicbrainz5/Release.h" + class MusicBrainz5::CQueryPrivate { public: @@ -69,6 +74,8 @@ class MusicBrainz5::CQueryPrivate CQuery::tQueryResult m_LastResult; int m_LastHTTPCode; std::string m_LastErrorMessage; + + static const int s_MinTimeBetweenRequestsInSeconds = 2; }; MusicBrainz5::CQuery::CQuery(const std::string& UserAgent, const std::string& Server, int Port) @@ -281,33 +288,62 @@ MusicBrainz5::CRelease MusicBrainz5::CQuery::LookupRelease(const std::string& Re return Release; } -void MusicBrainz5::CQuery::WaitRequest() const -{ - if (m_d->m_Server.find("musicbrainz.org")!=std::string::npos) - { - static struct timeval LastRequest; - const int TimeBetweenRequests=2; - - struct timeval TimeNow; - gettimeofday(&TimeNow,0); - if (LastRequest.tv_sec!=0 || LastRequest.tv_usec!=0) +#ifndef _MSC_VER + void MusicBrainz5::CQuery::WaitRequest() const + { + if (m_d->m_Server.find("musicbrainz.org")!=std::string::npos) { - struct timeval Diff; + static struct timeval LastRequest; + + struct timeval TimeNow; + gettimeofday(&TimeNow,0); - do + if (LastRequest.tv_sec!=0 || LastRequest.tv_usec!=0) { - gettimeofday(&TimeNow,0); - timersub(&TimeNow,&LastRequest,&Diff); + struct timeval Diff; + + do + { + gettimeofday(&TimeNow,0); + timersub(&TimeNow,&LastRequest,&Diff); + + if (Diff.tv_sec < m_d->s_MinTimeBetweenRequestsInSeconds) + usleep(100000); + } while (Diff.tv_sec < m_d->s_MinTimeBetweenRequestsInSeconds); + } - if (Diff.tv_secm_Server.find("musicbrainz.org") != std::string::npos) + { + static DWORD LastRequest = 0; + static const int MinTimeBetweenRequestsInMilliseconds = m_d->s_MinTimeBetweenRequestsInSeconds * 1000; + + DWORD TimeNow = timeGetTime(); + if (LastRequest != 0) + { + DWORD Diff; + + do + { + TimeNow = timeGetTime(); + Diff = TimeNow - LastRequest; - memcpy(&LastRequest,&TimeNow,sizeof(LastRequest)); + if (Diff < MinTimeBetweenRequestsInMilliseconds) + Sleep(100); + } while (Diff < MinTimeBetweenRequestsInMilliseconds); + } + + LastRequest = TimeNow; + } } -} + +#endif bool MusicBrainz5::CQuery::AddCollectionEntries(const std::string& CollectionID, const std::vector& Entries) { diff --git a/src/c-int-medium-defines.inc b/src/c-int-medium-defines.inc index f9e1b71..8750462 100644 --- a/src/c-int-medium-defines.inc +++ b/src/c-int-medium-defines.inc @@ -30,4 +30,4 @@ * * @return 1 if DiscID found, 0 otherwise */ - unsigned char mb5_medium_contains_discid(Mb5Medium Medium, const char *DiscID); + MB_API unsigned char mb5_medium_contains_discid(Mb5Medium Medium, const char *DiscID); diff --git a/src/c-int-query-defines.inc b/src/c-int-query-defines.inc index 88830ec..e6253a6 100644 --- a/src/c-int-query-defines.inc +++ b/src/c-int-query-defines.inc @@ -35,7 +35,7 @@ * finished with. */ - Mb5Query mb5_query_new(const char *UserAgent, const char *Server, int Port); + MB_API Mb5Query mb5_query_new(const char *UserAgent, const char *Server, int Port); /** * Set the username for authenticating to MusicBrainz @@ -45,7 +45,7 @@ * @param Query #Mb5Query object * @param UserName Username to use */ - void mb5_query_set_username(Mb5Query Query, const char *UserName); + MB_API void mb5_query_set_username(Mb5Query Query, const char *UserName); /** * Set the password for authenticating to MusicBrainz @@ -55,7 +55,7 @@ * @param Query #Mb5Query object * @param Password Password to use */ - void mb5_query_set_password(Mb5Query Query, const char *Password); + MB_API void mb5_query_set_password(Mb5Query Query, const char *Password); /** * Set the proxy server @@ -65,7 +65,7 @@ * @param Query #Mb5Query object * @param ProxyHost Proxy server to use */ - void mb5_query_set_proxyhost(Mb5Query Query, const char *ProxyHost); + MB_API void mb5_query_set_proxyhost(Mb5Query Query, const char *ProxyHost); /** * Set the port to use on the proxy server @@ -75,7 +75,7 @@ * @param Query #Mb5Query object * @param ProxyPort Port to use on proxy server */ - void mb5_query_set_proxyport(Mb5Query Query, int ProxyPort); + MB_API void mb5_query_set_proxyport(Mb5Query Query, int ProxyPort); /** * Set the username to use to authenticate to the proxy server @@ -85,7 +85,7 @@ * @param Query #Mb5Query object * @param ProxyUserName User name to use */ - void mb5_query_set_proxyusername(Mb5Query Query, const char *ProxyUserName); + MB_API void mb5_query_set_proxyusername(Mb5Query Query, const char *ProxyUserName); /** * Set the password to use to authenticate to the proxy server @@ -95,7 +95,7 @@ * @param Query #Mb5Query object * @param ProxyPassword Password to use */ - void mb5_query_set_proxypassword(Mb5Query Query, const char *ProxyPassword); + MB_API void mb5_query_set_proxypassword(Mb5Query Query, const char *ProxyPassword); /** * Return a list of releases that match the specified Disc ID @@ -108,7 +108,7 @@ * @return A #Mb5ReleaseList object. This object must be deleted once * finished with. */ - Mb5ReleaseList mb5_query_lookup_discid(Mb5Query Query, const char *DiscID); + MB_API Mb5ReleaseList mb5_query_lookup_discid(Mb5Query Query, const char *DiscID); /** * Return full information about a specific release @@ -121,7 +121,7 @@ * @return A #Mb5Release object. This object must be deleted once * finished with. */ - Mb5Release mb5_query_lookup_release(Mb5Query Query, const char *Release); + MB_API Mb5Release mb5_query_lookup_release(Mb5Query Query, const char *Release); /** * Perform a generic query @@ -139,7 +139,7 @@ * @return A #Mb5Metadata object. This object must be deleted once * finished with. */ - Mb5Metadata mb5_query_query(Mb5Query Query, const char *Entity, const char *ID, const char *Resource, int NumParams, char **ParamNames, char **ParamValues); + MB_API Mb5Metadata mb5_query_query(Mb5Query Query, const char *Entity, const char *ID, const char *Resource, int NumParams, char **ParamNames, char **ParamValues); /** * Add a list of releases to a collection @@ -153,7 +153,7 @@ * * @return 0 on failure, 1 on success */ - unsigned char mb5_query_add_collection_entries(Mb5Query Query, const char *Collection, int NumEntries, const char **Entries); + MB_API unsigned char mb5_query_add_collection_entries(Mb5Query Query, const char *Collection, int NumEntries, const char **Entries); /** * Delete a list of releases from a collection @@ -167,7 +167,7 @@ * * @return 0 on failure, 1 on success */ - unsigned char mb5_query_delete_collection_entries(Mb5Query Query, const char *Collection, int NumEntries, const char **Entries); + MB_API unsigned char mb5_query_delete_collection_entries(Mb5Query Query, const char *Collection, int NumEntries, const char **Entries); /** * @see MusicBrainz5::CQuery::tQueryResult @@ -191,5 +191,5 @@ * * @return Last query result code */ - tQueryResult mb5_query_get_lastresult(Mb5Query Query); + MB_API tQueryResult mb5_query_get_lastresult(Mb5Query Query); diff --git a/src/c-int-release-defines.inc b/src/c-int-release-defines.inc index a4c5e22..4e286ac 100644 --- a/src/c-int-release-defines.inc +++ b/src/c-int-release-defines.inc @@ -31,5 +31,5 @@ * @return #Mb5MediumList. This object must be deleted once * finished with. */ - Mb5MediumList mb5_release_media_matching_discid(Mb5Release Release, const char *DiscID); + MB_API Mb5MediumList mb5_release_media_matching_discid(Mb5Release Release, const char *DiscID); diff --git a/src/make-c-interface.cc b/src/make-c-interface.cc index 70dd6d7..d0001ac 100644 --- a/src/make-c-interface.cc +++ b/src/make-c-interface.cc @@ -189,7 +189,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_attributes_size(Mb5Entity Entity);" << std::endl; + Include << " MB_API int mb5_entity_ext_attributes_size(Mb5Entity Entity);" << std::endl; Include << std::endl; Include << "/**" << std::endl; @@ -202,7 +202,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_attribute_name(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; + Include << " MB_API int mb5_entity_ext_attribute_name(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; Include << std::endl; Include << "/**" << std::endl; @@ -215,7 +215,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_attribute_value(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; + Include << " MB_API int mb5_entity_ext_attribute_value(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; Include << std::endl; Include << "/**" << std::endl; @@ -225,7 +225,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_elements_size(Mb5Entity Entity);" << std::endl; + Include << " MB_API int mb5_entity_ext_elements_size(Mb5Entity Entity);" << std::endl; Include << std::endl; Include << "/**" << std::endl; @@ -238,7 +238,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_element_name(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; + Include << " MB_API int mb5_entity_ext_element_name(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; Include << std::endl; Include << "/**" << std::endl; @@ -251,7 +251,7 @@ void ProcessEntity(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_entity_ext_element_value(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; + Include << " MB_API int mb5_entity_ext_element_value(Mb5Entity Entity, int Item, char *str, int len);" << std::endl; Include << std::endl; Source << " MB5_C_EXT_GETTER(Attribute,attribute)" << std::endl; @@ -276,7 +276,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << "*" << std::endl; Include << "* @param " << UpperName << " Object to delete" << std::endl; Include << "*/" << std::endl; - Include << " void mb5_" << LowerName << "_delete(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API void mb5_" << LowerName << "_delete(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_DELETE(" << UpperName << "," << LowerName << ")" << std::endl; @@ -289,7 +289,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << "* @return Cloned object. This object must be deleted once" << std::endl; Include << "* finished with." << std::endl; Include << "*/" << std::endl; - Include << " Mb5" << UpperName << " mb5_" << LowerName << "_clone(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API Mb5" << UpperName << " mb5_" << LowerName << "_clone(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_CLONE(" << UpperName << "," << LowerName << ")" << std::endl; @@ -354,7 +354,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc if (Deprecated) Include << "LIBMB5_DEPRECATED(" << Replacement << ") "; - Include << "int mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ", char *str, int len);" << std::endl; + Include << "MB_API int mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ", char *str, int len);" << std::endl; Include << std::endl; Source << " MB5_C_STR_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -368,7 +368,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return Returned value" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_INT_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -382,7 +382,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return Returned value" << std::endl; Include << " */" << std::endl; - Include << " double mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API double mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_DOUBLE_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -396,7 +396,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return #Mb5" << PropertyUpperName << " object" << std::endl; Include << " */" << std::endl; - Include << " Mb5" << PropertyUpperName << " mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API Mb5" << PropertyUpperName << " mb5_" << LowerName << "_get_" << PropertyLowerName << "(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_OBJ_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -410,7 +410,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return #Mb5" << PropertyUpperName << "List object" << std::endl; Include << " */" << std::endl; - Include << " Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_OBJ_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "List," << PropertyLowerName << "list)" << std::endl; @@ -424,7 +424,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return #Mb5" << PropertyUpperName << "List object" << std::endl; Include << " */" << std::endl; - Include << " Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_OBJ_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "List," << PropertyLowerName << "list)" << std::endl; @@ -438,7 +438,7 @@ void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Inc Include << " *" << std::endl; Include << " * @return #Mb5" << PropertyUpperName << "List object" << std::endl; Include << " */" << std::endl; - Include << " Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; + Include << " MB_API Mb5" << PropertyUpperName << "List mb5_" << LowerName << "_get_" << PropertyLowerName << "list(Mb5" << UpperName << " " << UpperName << ");" << std::endl; Include << std::endl; Source << " MB5_C_OBJ_GETTER(" << UpperName << "," << LowerName << "," << PropertyUpperName << "List," << PropertyLowerName << "list)" << std::endl; @@ -483,14 +483,14 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @param List List to delete" << std::endl; Include << " */" << std::endl; - Include << " void mb5_" << LowerName << "_list_delete(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API void mb5_" << LowerName << "_list_delete(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Include << "/**" << std::endl; Include << " * Return the number of entries in a #Mb5" << UpperName << "List" << std::endl; Include << " *" << std::endl; Include << " * @param List List to use" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_size(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_size(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Include << "/**" << std::endl; Include << " * Returns an entry from a #Mb5" << UpperName << "List" << std::endl; @@ -500,21 +500,21 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @return A #Mb5" << UpperName << " object." << std::endl; Include << " */" << std::endl; - Include << " Mb5" << UpperName << " mb5_" << LowerName << "_list_item(Mb5" << UpperName << "List List, int Item);" << std::endl; + Include << " MB_API Mb5" << UpperName << " mb5_" << LowerName << "_list_item(Mb5" << UpperName << "List List, int Item);" << std::endl; Include << std::endl; Include << "/**" << std::endl; Include << " * Return the count of entries in an #Mb5" << UpperName << "List" << std::endl; Include << " *" << std::endl; Include << " * @param List List to use" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_get_count(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_get_count(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Include << "/**" << std::endl; Include << " * Return the offset of entries in an #Mb5" << UpperName << "List" << std::endl; Include << " *" << std::endl; Include << " * @param List List to use" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_get_offset(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_get_offset(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Source << " MB5_C_LIST_GETTER(" << UpperName << "," << LowerName << ")" << std::endl; @@ -527,7 +527,7 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << "* @return Cloned list. This list must be deleted once" << std::endl; Include << "* finished with." << std::endl; Include << "*/" << std::endl; - Include << " Mb5" << UpperName << "List mb5_" << LowerName << "_list_clone(Mb5" << UpperName << "List " << UpperName << "List" << ");" << std::endl; + Include << " MB_API Mb5" << UpperName << "List mb5_" << LowerName << "_list_clone(Mb5" << UpperName << "List " << UpperName << "List" << ");" << std::endl; Include << std::endl; Source << " MB5_C_CLONE(" << UpperName << "List," << LowerName << "_list)" << std::endl; @@ -562,7 +562,7 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @return The number of characters in the string to copy (not including terminating NULL)" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List, char *str, int len);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List, char *str, int len);" << std::endl; Include << std::endl; Source << " MB5_C_STR_GETTER(" << UpperName << "List," << LowerName << "_list," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -576,7 +576,7 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @return Returned value" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Source << " MB5_C_INT_GETTER(" << UpperName << "List," << LowerName << "_list," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -590,7 +590,7 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @return Returned value" << std::endl; Include << " */" << std::endl; - Include << " double mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API double mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Source << " MB5_C_DOUBLE_GETTER(" << UpperName << "List," << LowerName << "_list," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; @@ -604,7 +604,7 @@ void ProcessList(const XMLNode& Node, std::ofstream& Source, std::ofstream& Incl Include << " *" << std::endl; Include << " * @return #Mb5" << PropertyUpperName << " object" << std::endl; Include << " */" << std::endl; - Include << " int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; + Include << " MB_API int mb5_" << LowerName << "_list_get_" << PropertyLowerName << "(Mb5" << UpperName << "List List);" << std::endl; Include << std::endl; Source << " MB5_C_OBJ_GETTER(" << UpperName << "List," << LowerName << "_list," << PropertyUpperName << "," << PropertyLowerName << ")" << std::endl; diff --git a/tests/mbtest.cc b/tests/mbtest.cc index 2467a2d..c82177b 100644 --- a/tests/mbtest.cc +++ b/tests/mbtest.cc @@ -24,7 +24,9 @@ #include -#include +#ifndef _MSC_VER + #include +#endif #include "musicbrainz5/Query.h" #include "musicbrainz5/Release.h"