aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/libsample/CMakeLists.txt2
-rw-r--r--tests/libsample/abstract.h4
-rw-r--r--tests/libsample/collector.h7
-rw-r--r--tests/libsample/complex.h4
-rw-r--r--tests/libsample/derived.h5
-rw-r--r--tests/libsample/echo.h4
-rw-r--r--tests/libsample/functions.h33
-rw-r--r--tests/libsample/implicitconv.h4
-rw-r--r--tests/libsample/injectcode.h3
-rw-r--r--tests/libsample/kindergarten.h3
-rw-r--r--tests/libsample/libsamplemacros.h52
-rw-r--r--tests/libsample/listuser.h4
-rw-r--r--tests/libsample/mapuser.h4
-rw-r--r--tests/libsample/modifications.h5
-rw-r--r--tests/libsample/multiple_derived.h8
-rw-r--r--tests/libsample/nondefaultctor.h4
-rw-r--r--tests/libsample/objecttype.h6
-rw-r--r--tests/libsample/oddbool.h6
-rw-r--r--tests/libsample/overload.h4
-rw-r--r--tests/libsample/pairuser.h4
-rw-r--r--tests/libsample/point.h34
-rw-r--r--tests/libsample/reference.h4
-rw-r--r--tests/libsample/samplenamespace.h14
-rw-r--r--tests/libsample/simplefile.h3
-rw-r--r--tests/libsample/size.h4
-rw-r--r--tests/libsample/sometime.h3
-rw-r--r--tests/libsample/str.h8
-rw-r--r--tests/libsample/virtualmethods.h4
28 files changed, 168 insertions, 72 deletions
diff --git a/tests/libsample/CMakeLists.txt b/tests/libsample/CMakeLists.txt
index 5633a4c88..534931aaf 100644
--- a/tests/libsample/CMakeLists.txt
+++ b/tests/libsample/CMakeLists.txt
@@ -27,8 +27,8 @@ str.cpp
virtualmethods.cpp
)
-add_definitions("-fvisibility=default")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_definitions("-DLIBSAMPLE_BUILD")
add_library(libsample SHARED ${libsample_SRC})
set_property(TARGET libsample PROPERTY PREFIX "")
diff --git a/tests/libsample/abstract.h b/tests/libsample/abstract.h
index 27c132683..63ac59441 100644
--- a/tests/libsample/abstract.h
+++ b/tests/libsample/abstract.h
@@ -35,7 +35,9 @@
#ifndef ABSTRACT_H
#define ABSTRACT_H
-class Abstract
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Abstract
{
public:
enum PrintFormat {
diff --git a/tests/libsample/collector.h b/tests/libsample/collector.h
index 1b47c5b8a..68d7f536c 100644
--- a/tests/libsample/collector.h
+++ b/tests/libsample/collector.h
@@ -36,8 +36,9 @@
#define COLLECTOR_H
#include <list>
+#include "libsamplemacros.h"
-class Collector
+class LIBSAMPLE_API Collector
{
public:
Collector() {}
@@ -59,7 +60,7 @@ private:
};
/* Helper for testing external operators */
-class IntWrapper
+class LIBSAMPLE_API IntWrapper
{
public:
IntWrapper(int x=0):value(x){}
@@ -67,7 +68,7 @@ public:
int value;
};
-Collector &operator<<(Collector&, const IntWrapper&);
+LIBSAMPLE_API Collector &operator<<(Collector&, const IntWrapper&);
#endif // COLLECTOR_H
diff --git a/tests/libsample/complex.h b/tests/libsample/complex.h
index 6ef0ebc5c..9ee2a4eeb 100644
--- a/tests/libsample/complex.h
+++ b/tests/libsample/complex.h
@@ -35,7 +35,9 @@
#ifndef COMPLEX_H
#define COMPLEX_H
-class Complex
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Complex
{
public:
Complex(double real = 0.0, double imag = 0.0);
diff --git a/tests/libsample/derived.h b/tests/libsample/derived.h
index e12042f90..9e0e33a82 100644
--- a/tests/libsample/derived.h
+++ b/tests/libsample/derived.h
@@ -35,14 +35,15 @@
#ifndef DERIVED_H
#define DERIVED_H
+#include "libsamplemacros.h"
#include "abstract.h"
-enum OverloadedFuncEnum {
+enum LIBSAMPLE_API OverloadedFuncEnum {
OverloadedFunc_ii,
OverloadedFunc_d
};
-class Derived : public Abstract
+class LIBSAMPLE_API Derived : public Abstract
{
public:
enum OtherOverloadedFuncEnum {
diff --git a/tests/libsample/echo.h b/tests/libsample/echo.h
index fcb6e67c0..962e19492 100644
--- a/tests/libsample/echo.h
+++ b/tests/libsample/echo.h
@@ -35,7 +35,9 @@
#ifndef ECHO_H
#define ECHO_H
-class Echo
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Echo
{
public:
Echo(){}
diff --git a/tests/libsample/functions.h b/tests/libsample/functions.h
index 81d872980..f6cf81b18 100644
--- a/tests/libsample/functions.h
+++ b/tests/libsample/functions.h
@@ -35,41 +35,42 @@
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
+#include "libsamplemacros.h"
#include <list>
#include <utility>
#include "complex.h"
#include "objecttype.h"
-enum GlobalEnum {
+enum LIBSAMPLE_API GlobalEnum {
NoThing,
FirstThing,
SecondThing,
ThirdThing
};
-enum GlobalOverloadFuncEnum {
+enum LIBSAMPLE_API GlobalOverloadFuncEnum {
GlobalOverloadFunc_i,
GlobalOverloadFunc_d
};
-void printSomething();
-int gimmeInt();
-double gimmeDouble();
-double multiplyPair(std::pair<double, double> pair);
-std::list<Complex> gimmeComplexList();
-Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair);
+LIBSAMPLE_API void printSomething();
+LIBSAMPLE_API int gimmeInt();
+LIBSAMPLE_API double gimmeDouble();
+LIBSAMPLE_API double multiplyPair(std::pair<double, double> pair);
+LIBSAMPLE_API std::list<Complex> gimmeComplexList();
+LIBSAMPLE_API Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair);
-int countCharacters(const char* text);
-char* makeCString();
-const char* returnCString();
+LIBSAMPLE_API int countCharacters(const char* text);
+LIBSAMPLE_API char* makeCString();
+LIBSAMPLE_API const char* returnCString();
-char* returnNullPrimitivePointer();
-ObjectType* returnNullObjectTypePointer();
-Event* returnNullValueTypePointer();
+LIBSAMPLE_API char* returnNullPrimitivePointer();
+LIBSAMPLE_API ObjectType* returnNullObjectTypePointer();
+LIBSAMPLE_API Event* returnNullValueTypePointer();
// Tests overloading on functions (!methods)
-GlobalOverloadFuncEnum overloadedFunc(int val);
-GlobalOverloadFuncEnum overloadedFunc(double val);
+LIBSAMPLE_API GlobalOverloadFuncEnum overloadedFunc(int val);
+LIBSAMPLE_API GlobalOverloadFuncEnum overloadedFunc(double val);
#endif // FUNCTIONS_H
diff --git a/tests/libsample/implicitconv.h b/tests/libsample/implicitconv.h
index 7d537fb13..36c78b9c3 100644
--- a/tests/libsample/implicitconv.h
+++ b/tests/libsample/implicitconv.h
@@ -35,7 +35,9 @@
#ifndef IMPLICITCONV_H
#define IMPLICITCONV_H
-class ImplicitConv
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API ImplicitConv
{
public:
enum CtorEnum {
diff --git a/tests/libsample/injectcode.h b/tests/libsample/injectcode.h
index 52d417199..73c4f37e9 100644
--- a/tests/libsample/injectcode.h
+++ b/tests/libsample/injectcode.h
@@ -35,10 +35,11 @@
#ifndef INJECTCODE_H
#define INJECTCODE_H
+#include "libsamplemacros.h"
#include <utility>
#include <string>
-class InjectCode
+class LIBSAMPLE_API InjectCode
{
public:
InjectCode();
diff --git a/tests/libsample/kindergarten.h b/tests/libsample/kindergarten.h
index e074b7e17..e01eb1503 100644
--- a/tests/libsample/kindergarten.h
+++ b/tests/libsample/kindergarten.h
@@ -35,10 +35,11 @@
#ifndef KINDERGARTEN_H
#define KINDERGARTEN_H
+#include "libsamplemacros.h"
#include <list>
#include "objecttype.h"
-class KinderGarten
+class LIBSAMPLE_API KinderGarten
{
public:
typedef std::list<ObjectType*> ChildList;
diff --git a/tests/libsample/libsamplemacros.h b/tests/libsample/libsamplemacros.h
new file mode 100644
index 000000000..4a845ab76
--- /dev/null
+++ b/tests/libsample/libsamplemacros.h
@@ -0,0 +1,52 @@
+/*
+* This file is part of the Shiboken Python Bindings Generator project.
+*
+* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+*
+* Contact: PySide team <contact@pyside.org>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* version 2.1 as published by the Free Software Foundation. Please
+* review the following information to ensure the GNU Lesser General
+* Public License version 2.1 requirements will be met:
+* http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+*
+* As a special exception to the GNU Lesser General Public License
+* version 2.1, the object code form of a "work that uses the Library"
+* may incorporate material from a header file that is part of the
+* Library. You may distribute such object code under terms of your
+* choice, provided that the incorporated material (i) does not exceed
+* more than 5% of the total size of the Library; and (ii) is limited to
+* numerical parameters, data structure layouts, accessors, macros,
+* inline functions and templates.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*/
+
+#ifndef LIBSAMPLEMACROS_H
+#define LIBSAMPLEMACROS_H
+
+#if defined _WIN32 || defined __CYGWIN__
+ #if LIBSAMPLE_BUILD
+ #define LIBSAMPLE_API __declspec(dllexport)
+ #else
+ #define LIBSAMPLE_API __declspec(dllimport)
+ #endif
+#else
+#if __GNUC__ >= 4
+ #define LIBSAMPLE_API __attribute__ ((visibility("default")))
+#else
+ #define LIBSAMPLE_API
+#endif
+#endif
+
+#endif
diff --git a/tests/libsample/listuser.h b/tests/libsample/listuser.h
index b57ce76b9..52dea8bda 100644
--- a/tests/libsample/listuser.h
+++ b/tests/libsample/listuser.h
@@ -39,7 +39,9 @@
#include "complex.h"
#include "point.h"
-class ListUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API ListUser
{
public:
typedef std::list<Point*> PointList;
diff --git a/tests/libsample/mapuser.h b/tests/libsample/mapuser.h
index 8165ec983..743a7e533 100644
--- a/tests/libsample/mapuser.h
+++ b/tests/libsample/mapuser.h
@@ -40,7 +40,9 @@
#include <utility>
#include "complex.h"
-class MapUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API MapUser
{
public:
MapUser() {}
diff --git a/tests/libsample/modifications.h b/tests/libsample/modifications.h
index 5061c1200..2014b7ecf 100644
--- a/tests/libsample/modifications.h
+++ b/tests/libsample/modifications.h
@@ -35,10 +35,11 @@
#ifndef MODIFICATIONS_H
#define MODIFICATIONS_H
+#include "libsamplemacros.h"
#include <utility>
#include "point.h"
-class Modifications
+class LIBSAMPLE_API Modifications
{
public:
Modifications() {}
@@ -106,7 +107,7 @@ public:
virtual const char* className();
};
-class AbstractModifications : public Modifications
+class LIBSAMPLE_API AbstractModifications : public Modifications
{
public:
AbstractModifications() {}
diff --git a/tests/libsample/multiple_derived.h b/tests/libsample/multiple_derived.h
index 531cdb28d..5ddfd112d 100644
--- a/tests/libsample/multiple_derived.h
+++ b/tests/libsample/multiple_derived.h
@@ -35,21 +35,23 @@
#ifndef MDERIVED_H
#define MDERIVED_H
-class MBase1
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API MBase1
{
public:
~MBase1() {}
virtual const char* name() { return "MBase"; }
};
-class MBase2
+class LIBSAMPLE_API MBase2
{
public:
~MBase2() {}
virtual const char* funcName() { return "MBase2.funcName"; }
};
-class MDerived : public MBase1, public MBase2
+class LIBSAMPLE_API MDerived : public MBase1, public MBase2
{
public:
MDerived();
diff --git a/tests/libsample/nondefaultctor.h b/tests/libsample/nondefaultctor.h
index 7f0e09428..9a0a98f72 100644
--- a/tests/libsample/nondefaultctor.h
+++ b/tests/libsample/nondefaultctor.h
@@ -35,7 +35,9 @@
#ifndef NONDEFAULTCTOR_H
#define NONDEFAULTCTOR_H
-class NonDefaultCtor
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API NonDefaultCtor
{
int m_value;
public:
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index f75bbeb35..eac12fd79 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -38,7 +38,9 @@
#include <list>
#include "str.h"
-struct Event
+#include "libsamplemacros.h"
+
+struct LIBSAMPLE_API Event
{
enum EventType {
NO_EVENT,
@@ -52,7 +54,7 @@ private:
EventType m_eventType;
};
-class ObjectType
+class LIBSAMPLE_API ObjectType
{
public:
typedef std::list<ObjectType*> ObjectTypeList;
diff --git a/tests/libsample/oddbool.h b/tests/libsample/oddbool.h
index fb7d9ff21..0d2565761 100644
--- a/tests/libsample/oddbool.h
+++ b/tests/libsample/oddbool.h
@@ -35,7 +35,9 @@
#ifndef ODDBOOL_H
#define ODDBOOL_H
-class OddBool
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API OddBool
{
public:
@@ -55,7 +57,7 @@ inline bool operator!=(OddBool b1, bool b2) { return !b1 != !b2; }
inline bool operator!=(bool b1, OddBool b2) { return !b1 != !b2; }
inline bool operator!=(OddBool b1, OddBool b2) { return !b1 != !b2; }
-class OddBoolUser
+class LIBSAMPLE_API OddBoolUser
{
public:
OddBoolUser() : m_oddbool(OddBool(false)) {};
diff --git a/tests/libsample/overload.h b/tests/libsample/overload.h
index 51fbae718..370fe4688 100644
--- a/tests/libsample/overload.h
+++ b/tests/libsample/overload.h
@@ -38,7 +38,9 @@
#include "size.h"
#include "point.h"
-class Overload
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Overload
{
public:
enum FunctionEnum {
diff --git a/tests/libsample/pairuser.h b/tests/libsample/pairuser.h
index 162d7753f..b3b958460 100644
--- a/tests/libsample/pairuser.h
+++ b/tests/libsample/pairuser.h
@@ -38,7 +38,9 @@
#include <utility>
#include "complex.h"
-class PairUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API PairUser
{
public:
PairUser() {}
diff --git a/tests/libsample/point.h b/tests/libsample/point.h
index 01570cff0..a81750391 100644
--- a/tests/libsample/point.h
+++ b/tests/libsample/point.h
@@ -38,7 +38,9 @@
#include "complex.h"
#include <utility>
-class Point
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Point
{
public:
Point(int x = 0, int y = 0);
@@ -63,12 +65,12 @@ public:
Point operator+(const Point& other);
Point operator-(const Point& other);
- friend Point operator*(const Point& pt, double mult);
- friend Point operator*(const Point& pt, int mult);
- friend Point operator*(double mult, const Point& pt);
- friend Point operator*(int mult, const Point& pt);
- friend Point operator-(const Point& pt);
- friend bool operator!(const Point& pt);
+ friend LIBSAMPLE_API Point operator*(const Point& pt, double mult);
+ friend LIBSAMPLE_API Point operator*(const Point& pt, int mult);
+ friend LIBSAMPLE_API Point operator*(double mult, const Point& pt);
+ friend LIBSAMPLE_API Point operator*(int mult, const Point& pt);
+ friend LIBSAMPLE_API Point operator-(const Point& pt);
+ friend LIBSAMPLE_API bool operator!(const Point& pt);
Point& operator+=(Point &other);
Point& operator-=(Point &other);
@@ -80,17 +82,17 @@ private:
double m_y;
};
-Point operator*(const Point& pt, double mult);
-Point operator*(const Point& pt, int mult);
-Point operator*(double mult, const Point& pt);
-Point operator*(int mult, const Point& pt);
-Point operator-(const Point& pt);
-bool operator!(const Point& pt);
+LIBSAMPLE_API Point operator*(const Point& pt, double mult);
+LIBSAMPLE_API Point operator*(const Point& pt, int mult);
+LIBSAMPLE_API Point operator*(double mult, const Point& pt);
+LIBSAMPLE_API Point operator*(int mult, const Point& pt);
+LIBSAMPLE_API Point operator-(const Point& pt);
+LIBSAMPLE_API bool operator!(const Point& pt);
-Complex transmutePointIntoComplex(const Point& point);
-Point transmuteComplexIntoPoint(const Complex& cpx);
+LIBSAMPLE_API Complex transmutePointIntoComplex(const Point& point);
+LIBSAMPLE_API Point transmuteComplexIntoPoint(const Complex& cpx);
-Point operator*(const Point& pt, double multiplier);
+LIBSAMPLE_API Point operator*(const Point& pt, double multiplier);
#endif // POINT_H
diff --git a/tests/libsample/reference.h b/tests/libsample/reference.h
index 1da27cc91..5c9e8c99a 100644
--- a/tests/libsample/reference.h
+++ b/tests/libsample/reference.h
@@ -35,7 +35,9 @@
#ifndef REFERENCE_H
#define REFERENCE_H
-class Reference
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Reference
{
public:
explicit Reference(int objId = -1)
diff --git a/tests/libsample/samplenamespace.h b/tests/libsample/samplenamespace.h
index 420b7a778..5d58ac279 100644
--- a/tests/libsample/samplenamespace.h
+++ b/tests/libsample/samplenamespace.h
@@ -35,32 +35,34 @@
#ifndef SAMPLENAMESPACE_H
#define SAMPLENAMESPACE_H
+#include "libsamplemacros.h"
+
namespace SampleNamespace
{
-enum Option {
+enum LIBSAMPLE_API Option {
None,
RandomNumber,
UnixTime
};
-enum InValue {
+enum LIBSAMPLE_API InValue {
ZeroIn,
OneIn,
TwoIn
};
-enum OutValue {
+enum LIBSAMPLE_API OutValue {
ZeroOut,
OneOut,
TwoOut
};
-OutValue enumInEnumOut(InValue in);
+LIBSAMPLE_API OutValue enumInEnumOut(InValue in);
-int getNumber(Option opt);
+LIBSAMPLE_API int getNumber(Option opt);
-inline double powerOfTwo(double num) {
+LIBSAMPLE_API inline double powerOfTwo(double num) {
return num * num;
}
diff --git a/tests/libsample/simplefile.h b/tests/libsample/simplefile.h
index 181144660..aad82c21e 100644
--- a/tests/libsample/simplefile.h
+++ b/tests/libsample/simplefile.h
@@ -35,9 +35,10 @@
#ifndef SIMPLEFILE_H
#define SIMPLEFILE_H
+#include "libsamplemacros.h"
#include <stdio.h>
-class SimpleFile
+class LIBSAMPLE_API SimpleFile
{
public:
explicit SimpleFile(const char* filename)
diff --git a/tests/libsample/size.h b/tests/libsample/size.h
index 504d711c6..cc9da4f2e 100644
--- a/tests/libsample/size.h
+++ b/tests/libsample/size.h
@@ -35,7 +35,9 @@
#ifndef SIZE_H
#define SIZE_H
-class Size
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Size
{
public:
Size(double width = 0.0, double height = 0.0) : m_width(width), m_height(height) {}
diff --git a/tests/libsample/sometime.h b/tests/libsample/sometime.h
index 12fd4e09c..1db8af865 100644
--- a/tests/libsample/sometime.h
+++ b/tests/libsample/sometime.h
@@ -35,11 +35,12 @@
#ifndef SOMETIME_H
#define SOMETIME_H
+#include "libsamplemacros.h"
#include "str.h"
#include "implicitconv.h"
#include "objecttype.h"
-class Time
+class LIBSAMPLE_API Time
{
public:
enum NumArgs {
diff --git a/tests/libsample/str.h b/tests/libsample/str.h
index 31266753e..52f46e6ba 100644
--- a/tests/libsample/str.h
+++ b/tests/libsample/str.h
@@ -36,7 +36,9 @@
#define STR_H
#include <string>
-class Str
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Str
{
public:
Str(const Str& s);
@@ -64,10 +66,10 @@ private:
void init(const char* cstr);
std::string m_str;
- friend Str operator+(int number, const Str& str);
+ friend LIBSAMPLE_API Str operator+(int number, const Str& str);
};
-Str operator+(int number, const Str& str);
+LIBSAMPLE_API Str operator+(int number, const Str& str);
#endif // STR_H
diff --git a/tests/libsample/virtualmethods.h b/tests/libsample/virtualmethods.h
index 8bd4b93f2..45d8ae71e 100644
--- a/tests/libsample/virtualmethods.h
+++ b/tests/libsample/virtualmethods.h
@@ -39,7 +39,9 @@
#include "complex.h"
#include "str.h"
-class VirtualMethods
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API VirtualMethods
{
public:
VirtualMethods() {}