added DLL export macro for exporting symbols in VS2017

This commit is contained in:
Angel Sánchez 2018-05-31 13:51:21 +02:00
parent 256cf494a3
commit 3282e464a1
5 changed files with 27 additions and 15 deletions

View File

@ -52,7 +52,7 @@ extern "C" {
VIPS_NAMESPACE_START VIPS_NAMESPACE_START
// Wrapper over im_col_display with ref counting // Wrapper over im_col_display with ref counting
class VDisplay { class VIPS_CC_API VDisplay {
struct refblock { struct refblock {
im_col_display *disp; // im_col_display struct im_col_display *disp; // im_col_display struct
im_col_tab_disp *luts; // luts built from this display im_col_tab_disp *luts; // luts built from this display

View File

@ -49,7 +49,7 @@
VIPS_NAMESPACE_START VIPS_NAMESPACE_START
// Error type // Error type
class VError : public std::exception { class VIPS_CC_API VError : public std::exception {
std::string _what; std::string _what;
public: public:
@ -76,7 +76,7 @@ inline std::ostream &operator<<( std::ostream &file, const VError &err )
return( file ); return( file );
} }
void verror( std::string str = "" ); void VIPS_CC_API verror( std::string str = "" );
VIPS_NAMESPACE_END VIPS_NAMESPACE_END

View File

@ -77,7 +77,7 @@ typedef int (*VCallback)( void *, void * );
* and several other refblocks can have IMAGEs which depend upon this IMAGE * and several other refblocks can have IMAGEs which depend upon this IMAGE
* for their result. * for their result.
*/ */
class VImage { class VIPS_CC_API VImage {
/* We'd like this to be protected so that user subclasses can define /* We'd like this to be protected so that user subclasses can define
* their own member wrappers. But sadly C++ doesn't work like that: * their own member wrappers. But sadly C++ doesn't work like that:
* subclasses of VImage can only refer to protected members via * subclasses of VImage can only refer to protected members via
@ -89,7 +89,7 @@ public:
*/ */
#ifndef SWIG #ifndef SWIG
// Count ref etc. in one of these. One for each open VIPS image. // Count ref etc. in one of these. One for each open VIPS image.
struct refblock { VIPS_CC_API struct refblock {
_VipsImage *im; // IMAGE pointer _VipsImage *im; // IMAGE pointer
int close_on_delete; // Set if we must im_close() int close_on_delete; // Set if we must im_close()
int nrefs; // Number of refs to us int nrefs; // Number of refs to us
@ -100,7 +100,7 @@ public:
virtual ~refblock(); virtual ~refblock();
// Add a ref - this (output image) depends upon IMAGE in // Add a ref - this (output image) depends upon IMAGE in
void addref( refblock *in ); VIPS_CC_API void addref( refblock *in );
// Remove a ref // Remove a ref
void removeref(); void removeref();
@ -420,7 +420,7 @@ public:
* be part of the public API in case people subclass VImage and add their own * be part of the public API in case people subclass VImage and add their own
* members. * members.
*/ */
class Vargv { class VIPS_CC_API Vargv {
// Function we are args to // Function we are args to
im__function *fn; im__function *fn;

View File

@ -73,7 +73,7 @@ union MASKUNION {
}; };
// Private wrapper over *MASK - user does not see this // Private wrapper over *MASK - user does not see this
class VPMask { class VIPS_CC_API VPMask {
friend class VMask; friend class VMask;
public: public:
@ -102,7 +102,7 @@ public:
}; };
// Specialise for INTMASK // Specialise for INTMASK
class VPIMask : public VPMask { class VIPS_CC_API VPIMask : public VPMask {
public: public:
VPIMask( int xsize, int ysize ); VPIMask( int xsize, int ysize );
VPIMask( int xsize, int ysize, int scale, int offset, VPIMask( int xsize, int ysize, int scale, int offset,
@ -129,7 +129,7 @@ public:
}; };
// Specialise for DOUBLEMASK // Specialise for DOUBLEMASK
class VPDMask : public VPMask { class VIPS_CC_API VPDMask : public VPMask {
public: public:
VPDMask( int xsize, int ysize ); VPDMask( int xsize, int ysize );
VPDMask( int xsize, int ysize, VPDMask( int xsize, int ysize,
@ -167,7 +167,7 @@ inline std::ostream &operator<<( std::ostream &file,
#endif /*!SWIG*/ #endif /*!SWIG*/
// Wrapper over VP?Mask with ref counting // Wrapper over VP?Mask with ref counting
class VMask { class VIPS_CC_API VMask {
protected: protected:
struct refblock { struct refblock {
_private_detail::VPMask *pmask; // Mask: double or int _private_detail::VPMask *pmask; // Mask: double or int
@ -221,11 +221,11 @@ inline std::ostream &operator<<( std::ostream &file, const VMask &msk )
} }
// Need to forward ref these // Need to forward ref these
class VDMask; class VIPS_CC_API VDMask;
class VImage; class VIPS_CC_API VImage;
// Wrapper over _private_detail::VPIMask with ref counting // Wrapper over _private_detail::VPIMask with ref counting
class VIMask : public VMask { class VIPS_CC_API VIMask : public VMask {
public: public:
VIMask( int xsize, int ysize ) VIMask( int xsize, int ysize )
{ {
@ -314,7 +314,7 @@ public:
}; };
// Wrapper over _private_detail::VPDMask with ref counting // Wrapper over _private_detail::VPDMask with ref counting
class VDMask : public VMask { class VIPS_CC_API VDMask : public VMask {
public: public:
VDMask( int xsize, int ysize ) VDMask( int xsize, int ysize )
{ {

View File

@ -35,6 +35,18 @@
// VImage.h uses GValue for metadata // VImage.h uses GValue for metadata
#include <glib-object.h> #include <glib-object.h>
/* Define VIPS_CC_EXPORTS to build a DLL using MSVC.
*/
#ifdef _MSC_VER
# ifdef VIPS_CC_EXPORTS
# define VIPS_CC_API __declspec(dllexport)
# else
# define VIPS_CC_API __declspec(dllimport)
# endif
#else
# define VIPS_CC_API
#endif
// If we have already #included the C vips headers, we have to undef a load of // If we have already #included the C vips headers, we have to undef a load of
// stuff to stop vips's stupid macros messing up our enums // stuff to stop vips's stupid macros messing up our enums
#ifdef IM_VIPS_H #ifdef IM_VIPS_H