]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright 2016 Klemens Morgenstern |
20effc67 | 2 | // Copyright 2017-2020 Antony Polukhin |
7c673cae FG |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // (See accompanying file LICENSE_1_0.txt | |
6 | // or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | // For more information, see http://www.boost.org | |
9 | ||
20effc67 | 10 | #include <boost/config.hpp> |
7c673cae | 11 | |
20effc67 | 12 | #if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) |
7c673cae | 13 | |
92f5a8d4 | 14 | #include <boost/dll/config.hpp> |
7c673cae FG |
15 | #include <boost/variant.hpp> |
16 | ||
17 | BOOST_SYMBOL_EXPORT extern int unscoped_var; | |
18 | int unscoped_var = 42; | |
19 | ||
20 | BOOST_SYMBOL_EXPORT extern const double unscoped_c_var; | |
21 | const double unscoped_c_var = 1.234; | |
22 | ||
23 | ||
24 | namespace some_space { | |
25 | ||
26 | BOOST_SYMBOL_EXPORT extern double variable; | |
27 | double variable = 0.2; | |
28 | BOOST_SYMBOL_EXPORT const int & scoped_fun() | |
29 | { | |
30 | static int x = 0xDEADBEEF; | |
31 | return x; | |
32 | } | |
33 | ||
34 | } | |
35 | ||
36 | ||
37 | BOOST_SYMBOL_EXPORT void overloaded(const volatile int i) | |
38 | { | |
39 | unscoped_var = i; | |
40 | } | |
41 | ||
42 | BOOST_SYMBOL_EXPORT void overloaded(const double d) | |
43 | { | |
44 | some_space::variable = d; | |
45 | } | |
46 | ||
47 | BOOST_SYMBOL_EXPORT void use_variant(boost::variant<int, double> & v) | |
48 | { | |
49 | v = 42; | |
50 | } | |
51 | ||
52 | BOOST_SYMBOL_EXPORT void use_variant(boost::variant<double, int> & v) | |
53 | { | |
54 | v = 3.124; | |
55 | } | |
56 | ||
57 | ||
58 | ||
59 | namespace some_space | |
60 | { | |
61 | ||
62 | BOOST_SYMBOL_EXPORT extern int father_value; | |
63 | int father_value = 12; | |
64 | ||
65 | struct BOOST_SYMBOL_EXPORT some_father | |
66 | { | |
67 | some_father() { father_value = 24; }; | |
68 | ~some_father() { father_value = 112; }; | |
69 | }; | |
70 | ||
71 | ||
72 | ||
73 | struct BOOST_SYMBOL_EXPORT some_class : some_father | |
74 | { | |
75 | static int value ; | |
76 | static void set_value(const int &i); | |
77 | ||
78 | // static some_class* dummy(); | |
79 | ||
80 | virtual double func(double i, double j); | |
81 | virtual int func(int i, int j); | |
82 | int func(int i, int j) volatile; | |
83 | double func(double i, double j) const volatile; | |
84 | ||
85 | int mem_val; | |
86 | int get() const ; | |
87 | void set(int i) ; | |
88 | ||
89 | some_class(); | |
90 | some_class(some_class &&); | |
91 | some_class(int i); | |
92 | ||
93 | some_class& operator=(some_class &&); | |
94 | ||
95 | ||
96 | virtual ~some_class(); | |
97 | }; | |
98 | ||
99 | some_class::some_class(some_class &&){} | |
100 | ||
101 | ||
102 | some_class& some_class::operator=(some_class &&ref) {return ref;} | |
103 | ||
104 | ||
105 | BOOST_SYMBOL_EXPORT extern std::size_t size_of_some_class; | |
106 | std::size_t size_of_some_class = sizeof(some_space::some_class); | |
107 | ||
108 | ||
109 | extern "C" BOOST_SYMBOL_EXPORT const volatile some_class* this_; | |
110 | const volatile some_class * this_ = nullptr; | |
111 | ||
112 | int some_class::value = -1; | |
113 | ||
114 | void some_class::set_value(const int &i) {value = i;} | |
115 | ||
116 | ||
117 | //some_class* some_class::dummy() {return new some_class();}//so it implements an allocating ctor. | |
118 | ||
119 | double some_class::func(double i, double j) {this_ = this; return i*j;} | |
120 | int some_class::func(int i, int j) {this_ = this; return i+j;} | |
121 | int some_class::func(int i, int j) volatile {this_ = this; return i-j;;} | |
122 | double some_class::func(double i, double j) const volatile {this_ = this; return i/j;} | |
123 | ||
124 | int some_class::get() const {this_ = this; return mem_val;} | |
125 | void some_class::set(int i) {this_ = this; mem_val = i;} | |
126 | ||
127 | some_class::some_class() { this_ = this; value = 23; mem_val = 123;} | |
128 | some_class::some_class(int i) : mem_val(456) {this_ = this; value = i;} | |
129 | ||
130 | some_class::~some_class() | |
131 | { | |
132 | value = 0; | |
133 | this_ = this; | |
134 | } | |
135 | ||
136 | } | |
137 | ||
f67539c2 TL |
138 | namespace space { |
139 | class BOOST_SYMBOL_EXPORT my_plugin; | |
140 | } | |
141 | ||
142 | namespace testing { namespace space { | |
143 | class BOOST_SYMBOL_EXPORT my_plugin { | |
144 | public: | |
145 | template<typename Arg> | |
146 | BOOST_SYMBOL_EXPORT int Func() const; | |
147 | template<typename Arg> | |
148 | BOOST_SYMBOL_EXPORT int Func(); | |
149 | template<typename Arg> | |
150 | BOOST_SYMBOL_EXPORT int Func2(); | |
151 | template<typename Arg> | |
152 | BOOST_SYMBOL_EXPORT int AFunc(); | |
153 | }; | |
154 | ||
155 | template<typename Arg> | |
156 | BOOST_SYMBOL_EXPORT int my_plugin::Func() const { return 30; } | |
157 | ||
158 | template<typename Arg> | |
159 | BOOST_SYMBOL_EXPORT int my_plugin::Func() { return 32; } | |
160 | ||
161 | template<typename Arg> | |
162 | BOOST_SYMBOL_EXPORT int my_plugin::Func2() { return 33; } | |
163 | ||
164 | template<typename Arg> | |
165 | BOOST_SYMBOL_EXPORT int my_plugin::AFunc() { return 31; } | |
166 | ||
167 | template BOOST_SYMBOL_EXPORT int my_plugin::Func<::space::my_plugin>(); | |
168 | template BOOST_SYMBOL_EXPORT int my_plugin::Func2<::space::my_plugin>(); | |
169 | template BOOST_SYMBOL_EXPORT int my_plugin::AFunc<::space::my_plugin>(); | |
170 | }} | |
171 | ||
172 | namespace space { | |
173 | class BOOST_SYMBOL_EXPORT my_plugin { | |
174 | public: | |
175 | template<typename Arg> | |
176 | BOOST_SYMBOL_EXPORT int Func() const; | |
177 | template<typename Arg> | |
178 | BOOST_SYMBOL_EXPORT int Func(); | |
179 | template<typename Arg> | |
180 | BOOST_SYMBOL_EXPORT int Func2(); | |
181 | template<typename Arg> | |
182 | BOOST_SYMBOL_EXPORT int AFunc(); | |
183 | }; | |
184 | ||
185 | template<typename Arg> | |
186 | BOOST_SYMBOL_EXPORT int my_plugin::Func() const { return 40; } | |
187 | ||
188 | template<typename Arg> | |
189 | BOOST_SYMBOL_EXPORT int my_plugin::Func() { return 42; } | |
190 | ||
191 | template<typename Arg> | |
192 | BOOST_SYMBOL_EXPORT int my_plugin::Func2() { return 43; } | |
193 | ||
194 | template<typename Arg> | |
195 | BOOST_SYMBOL_EXPORT int my_plugin::AFunc() { return 41; } | |
196 | ||
197 | template BOOST_SYMBOL_EXPORT int my_plugin::Func<::space::my_plugin>(); | |
198 | template BOOST_SYMBOL_EXPORT int my_plugin::Func2<::space::my_plugin>(); | |
199 | template BOOST_SYMBOL_EXPORT int my_plugin::AFunc<::space::my_plugin>(); | |
200 | } | |
201 | ||
7c673cae FG |
202 | |
203 | #endif |