Skip to content

Commit 81d16d9

Browse files
committed
Explicitly export exception types.
1 parent b263ba5 commit 81d16d9

File tree

10 files changed

+28
-9
lines changed

10 files changed

+28
-9
lines changed

include/gdalcpp.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ DEALINGS IN THE SOFTWARE.
4242
#include <ogr_api.h>
4343
#include <ogrsf_frmts.h>
4444

45+
#include <osmium/util/compatibility.hpp>
46+
4547
#include <cstdint>
4648
#include <algorithm>
4749
#include <memory>
@@ -63,7 +65,7 @@ namespace gdalcpp {
6365
/**
6466
* Exception thrown for all errors in this class.
6567
*/
66-
class gdal_error : public std::runtime_error {
68+
class OSMIUM_EXPORT gdal_error : public std::runtime_error {
6769

6870
std::string m_driver;
6971
std::string m_dataset;

include/osmium/geom/factory.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ DEALINGS IN THE SOFTWARE.
4444
#include <osmium/osm/node_ref_list.hpp>
4545
#include <osmium/osm/types.hpp>
4646
#include <osmium/osm/way.hpp>
47+
#include <osmium/util/compatibility.hpp>
4748

4849
#include <cstddef>
4950
#include <stdexcept>
@@ -56,7 +57,7 @@ namespace osmium {
5657
* Exception thrown when an invalid geometry is encountered. An example
5758
* would be a linestring with less than two points.
5859
*/
59-
class geometry_error : public std::runtime_error {
60+
class OSMIUM_EXPORT geometry_error : public std::runtime_error {
6061

6162
std::string m_message;
6263
osmium::object_id_type m_id;

include/osmium/geom/util.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
3333
3434
*/
3535

36+
#include <osmium/util/compatibility.hpp>
37+
3638
#include <stdexcept>
3739
#include <string>
3840

@@ -42,7 +44,7 @@ namespace osmium {
4244
* Exception thrown when a projection object can not be initialized or the
4345
* projection of some coordinates can not be calculated.
4446
*/
45-
struct projection_error : public std::runtime_error {
47+
struct OSMIUM_EXPORT projection_error : public std::runtime_error {
4648

4749
explicit projection_error(const std::string& what) :
4850
std::runtime_error(what) {

include/osmium/handler/check_order.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ DEALINGS IN THE SOFTWARE.
3939
#include <osmium/osm/relation.hpp>
4040
#include <osmium/osm/types.hpp>
4141
#include <osmium/osm/way.hpp>
42+
#include <osmium/util/compatibility.hpp>
4243

4344
#include <limits>
4445
#include <stdexcept>
@@ -50,7 +51,7 @@ namespace osmium {
5051
* Exception thrown when a method in the CheckOrder class detects
5152
* that the input is out of order.
5253
*/
53-
struct out_of_order_error : public std::runtime_error {
54+
struct OSMIUM_EXPORT out_of_order_error : public std::runtime_error {
5455

5556
osmium::object_id_type object_id;
5657

include/osmium/index/index.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
3333
3434
*/
3535

36+
#include <osmium/util/compatibility.hpp>
37+
3638
#include <cstddef>
3739
#include <cstdint>
3840
#include <limits>
@@ -45,7 +47,7 @@ namespace osmium {
4547
* Exception signaling that an element could not be
4648
* found in an index.
4749
*/
48-
struct not_found : public std::runtime_error {
50+
struct OSMIUM_EXPORT not_found : public std::runtime_error {
4951

5052
explicit not_found(const std::string& what) :
5153
std::runtime_error(what) {

include/osmium/index/map.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ DEALINGS IN THE SOFTWARE.
3333
3434
*/
3535

36+
#include <osmium/util/compatibility.hpp>
3637
#include <osmium/util/string.hpp>
3738

3839
#include <algorithm>
@@ -47,7 +48,7 @@ DEALINGS IN THE SOFTWARE.
4748

4849
namespace osmium {
4950

50-
struct map_factory_error : public std::runtime_error {
51+
struct OSMIUM_EXPORT map_factory_error : public std::runtime_error {
5152

5253
explicit map_factory_error(const char* message) :
5354
std::runtime_error(message) {

include/osmium/io/error.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
3333
3434
*/
3535

36+
#include <osmium/util/compatibility.hpp>
37+
3638
#include <stdexcept>
3739
#include <string>
3840

@@ -41,7 +43,7 @@ namespace osmium {
4143
/**
4244
* Exception thrown when some kind of input/output operation failed.
4345
*/
44-
struct io_error : public std::runtime_error {
46+
struct OSMIUM_EXPORT io_error : public std::runtime_error {
4547

4648
explicit io_error(const std::string& what) :
4749
std::runtime_error(what) {

include/osmium/memory/buffer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace osmium {
5555
* to write data into a buffer and it doesn't fit. Buffers with internal
5656
* memory management will not throw this exception, but increase their size.
5757
*/
58-
struct buffer_is_full : public std::runtime_error {
58+
struct OSMIUM_EXPORT buffer_is_full : public std::runtime_error {
5959

6060
buffer_is_full() :
6161
std::runtime_error{"Osmium buffer is full"} {

include/osmium/osm/item_type.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
3333
3434
*/
3535

36+
#include <osmium/util/compatibility.hpp>
37+
3638
#include <cassert>
3739
#include <cstdint> // IWYU pragma: keep
3840
#include <iosfwd>
@@ -192,7 +194,7 @@ namespace osmium {
192194
* probably means the buffer contains different kinds of objects than were
193195
* expected or that there is some kind of data corruption.
194196
*/
195-
struct unknown_type : public std::runtime_error {
197+
struct OSMIUM_EXPORT unknown_type : public std::runtime_error {
196198

197199
unknown_type() :
198200
std::runtime_error("unknown item type") {

include/osmium/util/compatibility.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,10 @@ DEALINGS IN THE SOFTWARE.
5151
# define OSMIUM_DEPRECATED
5252
#endif
5353

54+
#if defined(_MSC_VER)
55+
# define OSMIUM_EXPORT __declspec(dllexport)
56+
#else
57+
# define OSMIUM_EXPORT __attribute__ ((visibility("default")))
58+
#endif
59+
5460
#endif // OSMIUM_UTIL_COMPATIBILITY_HPP

0 commit comments

Comments
 (0)