Enable compilation of vips8 C++ bindings with MSVC

Add VIPS_CPLUSPLUS_API macro to allow DLL creation
This commit is contained in:
Lovell Fuller 2016-01-11 17:55:59 +00:00
parent 50db131865
commit 20ae80397d
4 changed files with 27 additions and 12 deletions

View File

@ -189,7 +189,8 @@ VOption::set( const char *name, std::vector<double> value )
pair->input = true;
g_value_init( &pair->value, VIPS_TYPE_ARRAY_DOUBLE );
vips_value_set_array_double( &pair->value, NULL, value.size() );
vips_value_set_array_double( &pair->value, NULL,
static_cast< int >( value.size() ) );
array = vips_value_get_array_double( &pair->value, NULL );
for( i = 0; i < value.size(); i++ )
@ -212,7 +213,8 @@ VOption::set( const char *name, std::vector<VImage> value )
pair->input = true;
g_value_init( &pair->value, VIPS_TYPE_ARRAY_IMAGE );
vips_value_set_array_image( &pair->value, value.size() );
vips_value_set_array_image( &pair->value,
static_cast< int >( value.size() ) );
array = vips_value_get_array_image( &pair->value, NULL );
for( i = 0; i < value.size(); i++ ) {
@ -400,7 +402,7 @@ VOption::get_operation( VipsOperation *operation )
std::list<Pair *>::iterator i;
for( i = options.begin(); i != options.end(); ++i )
if( not (*i)->input ) {
if( ! (*i)->input ) {
const char *name = (*i)->name;
g_object_get_property( G_OBJECT( operation ),

View File

@ -39,7 +39,7 @@
VIPS_NAMESPACE_START
class VError : public std::exception {
class VIPS_CPLUSPLUS_API VError : public std::exception {
std::string _what;
public:

View File

@ -43,11 +43,11 @@ VIPS_NAMESPACE_START
/* Small utility things.
*/
std::vector<double> to_vectorv( int n, ... );
std::vector<double> to_vector( double value );
std::vector<double> to_vector( int n, double array[] );
std::vector<double> negate( std::vector<double> value );
std::vector<double> invert( std::vector<double> value );
VIPS_CPLUSPLUS_API std::vector<double> to_vectorv( int n, ... );
VIPS_CPLUSPLUS_API std::vector<double> to_vector( double value );
VIPS_CPLUSPLUS_API std::vector<double> to_vector( int n, double array[] );
VIPS_CPLUSPLUS_API std::vector<double> negate( std::vector<double> value );
VIPS_CPLUSPLUS_API std::vector<double> invert( std::vector<double> value );
enum VSteal {
NOSTEAL = 0,
@ -162,9 +162,9 @@ public:
};
class VImage;
class VInterpolate;
class VOption;
class VIPS_CPLUSPLUS_API VImage;
class VIPS_CPLUSPLUS_API VInterpolate;
class VIPS_CPLUSPLUS_API VOption;
class VOption
{

View File

@ -34,6 +34,19 @@
#include <glib-object.h>
/*
Define VIPS_CPLUSPLUS_EXPORTS to build a DLL using MSVC
*/
#ifdef _MSC_VER
# ifdef VIPS_CPLUSPLUS_EXPORTS
# define VIPS_CPLUSPLUS_API __declspec(dllexport)
# else
# define VIPS_CPLUSPLUS_API __declspec(dllimport)
# endif
#else
# define VIPS_CPLUSPLUS_API
#endif
#define VIPS_NAMESPACE_START namespace vips {
#define VIPS_NAMESPACE_END }