Skip to content

Commit 3f1c215

Browse files
committed
export vtable in MinGW GCC builds
Fixes #214
1 parent c4f0796 commit 3f1c215

File tree

7 files changed

+36
-10
lines changed

7 files changed

+36
-10
lines changed

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,21 @@ T default_value();
6060
- Concise, dry answers
6161
- Full files, not diffs
6262
- Accurate, compiling C++ code
63+
64+
## Symbol Visibility
65+
66+
- Mark **all public classes with virtual functions or virtual base classes** with
67+
`BOOST_HTTP_PROTO_SYMBOL_VISIBLE`.
68+
69+
- This is required for:
70+
- DSO (Dynamic Shared Object) builds compiled with hidden visibility.
71+
- DLL builds with MinGW GCC due to its [non-conformance with MSVC](https://github.com/cppalliance/http_proto/issues/214).
72+
73+
- Mark **all public exception types** and **public classes used as the operand of `dynamic_cast`** with
74+
`BOOST_HTTP_PROTO_DECL`.
75+
76+
- This ensures:
77+
- RTTI (typeinfo) is exported from DLLs.
78+
- RTTI is visible from DSOs.
79+
- Once a class is marked with `BOOST_HTTP_PROTO_DECL`, **all of its member functions are exported automatically**.
80+
- Do **not** mark the member functions individually.

include/boost/http_proto/detail/config.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ namespace http_proto {
3333
# define BOOST_HTTP_PROTO_DECL
3434
# endif
3535

36+
#if defined(__MINGW32__)
37+
#define BOOST_HTTP_PROTO_SYMBOL_VISIBLE BOOST_HTTP_PROTO_DECL
38+
#else
39+
#define BOOST_HTTP_PROTO_SYMBOL_VISIBLE BOOST_SYMBOL_VISIBLE
40+
#endif
41+
3642
# if !defined(BOOST_HTTP_PROTO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_HTTP_PROTO_NO_LIB)
3743
# define BOOST_LIB_NAME boost_http_proto
3844
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_HTTP_PROTO_DYN_LINK)

include/boost/http_proto/impl/error.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace http_proto {
4141

4242
namespace detail {
4343

44-
struct BOOST_SYMBOL_VISIBLE
44+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
4545
error_cat_type
4646
: system::error_category
4747
{
@@ -58,7 +58,7 @@ struct BOOST_SYMBOL_VISIBLE
5858
}
5959
};
6060

61-
struct BOOST_SYMBOL_VISIBLE
61+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
6262
condition_cat_type
6363
: system::error_category
6464
{

include/boost/http_proto/server/route_handler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct acceptor_config
3434

3535
/** Parameters object for HTTP route handlers
3636
*/
37-
struct BOOST_SYMBOL_VISIBLE
37+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
3838
route_params : route_params_base
3939
{
4040
/** The complete request target
@@ -180,7 +180,7 @@ post(F&& f) -> route_result
180180
if(task_)
181181
detail::throw_invalid_argument();
182182

183-
struct BOOST_SYMBOL_VISIBLE
183+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
184184
immediate : detacher::owner
185185
{
186186
route_result rv;
@@ -193,7 +193,7 @@ post(F&& f) -> route_result
193193
}
194194
};
195195

196-
class BOOST_SYMBOL_VISIBLE model
196+
class BOOST_HTTP_PROTO_SYMBOL_VISIBLE model
197197
: public task
198198
, public detacher::owner
199199
{

include/boost/http_proto/server/router_types.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using route_result = system::error_code;
3636
3737
These values determine how the caller proceeds after invoking
3838
a route handler. Each enumerator represents a distinct control
39-
actionwhether the request was handled, should continue to the
39+
actionwhether the request was handled, should continue to the
4040
next route, transfers ownership of the session, or signals that
4141
the connection should be closed.
4242
*/
@@ -111,7 +111,7 @@ struct is_error_code_enum<
111111
namespace http_proto {
112112

113113
namespace detail {
114-
struct BOOST_SYMBOL_VISIBLE route_cat_type
114+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE route_cat_type
115115
: system::error_category
116116
{
117117
BOOST_HTTP_PROTO_DECL const char* name() const noexcept override;
@@ -162,7 +162,7 @@ class detacher
162162
public:
163163
/** Base class of the implementation
164164
*/
165-
struct BOOST_SYMBOL_VISIBLE
165+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
166166
owner
167167
{
168168
BOOST_HTTP_PROTO_DECL virtual resumer do_detach();

include/boost/http_proto/sink.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace http_proto {
3636
@ref source,
3737
@ref parser.
3838
*/
39-
struct BOOST_HTTP_PROTO_DECL
39+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
4040
sink
4141
{
4242
/** The results of consuming data.
@@ -188,6 +188,7 @@ struct BOOST_HTTP_PROTO_DECL
188188
@param more `true` if there will be one
189189
or more subsequent calls.
190190
*/
191+
BOOST_HTTP_PROTO_DECL
191192
virtual
192193
results
193194
on_write(

include/boost/http_proto/source.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace http_proto {
3636
@ref sink,
3737
@ref serializer.
3838
*/
39-
struct BOOST_HTTP_PROTO_DECL
39+
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
4040
source
4141
{
4242
/** The results of producing data.
@@ -191,6 +191,7 @@ struct BOOST_HTTP_PROTO_DECL
191191
indicate failure or that no more
192192
data remains (or both).
193193
*/
194+
BOOST_HTTP_PROTO_DECL
194195
virtual
195196
results
196197
on_read(

0 commit comments

Comments
 (0)