Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,21 @@ T default_value();
- Concise, dry answers
- Full files, not diffs
- Accurate, compiling C++ code

## Symbol Visibility

- Mark **all public classes with virtual functions or virtual base classes** with
`BOOST_HTTP_PROTO_SYMBOL_VISIBLE`.

- This is required for:
- DSO (Dynamic Shared Object) builds compiled with hidden visibility.
- DLL builds with MinGW GCC due to its [non-conformance with MSVC](https://github.com/cppalliance/http_proto/issues/214).

- Mark **all public exception types** and **public classes used as the operand of `dynamic_cast`** with
`BOOST_HTTP_PROTO_DECL`.

- This ensures:
- RTTI (typeinfo) is exported from DLLs.
- RTTI is visible from DSOs.
- Once a class is marked with `BOOST_HTTP_PROTO_DECL`, **all of its member functions are exported automatically**.
- Do **not** mark the member functions individually.
6 changes: 6 additions & 0 deletions include/boost/http_proto/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ namespace http_proto {
# define BOOST_HTTP_PROTO_DECL
# endif

#if defined(__MINGW32__)
#define BOOST_HTTP_PROTO_SYMBOL_VISIBLE BOOST_HTTP_PROTO_DECL
#else
#define BOOST_HTTP_PROTO_SYMBOL_VISIBLE BOOST_SYMBOL_VISIBLE
#endif

# if !defined(BOOST_HTTP_PROTO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_HTTP_PROTO_NO_LIB)
# define BOOST_LIB_NAME boost_http_proto
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_HTTP_PROTO_DYN_LINK)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/http_proto/impl/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace http_proto {

namespace detail {

struct BOOST_SYMBOL_VISIBLE
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
error_cat_type
: system::error_category
{
Expand All @@ -58,7 +58,7 @@ struct BOOST_SYMBOL_VISIBLE
}
};

struct BOOST_SYMBOL_VISIBLE
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
condition_cat_type
: system::error_category
{
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http_proto/server/route_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct acceptor_config

/** Parameters object for HTTP route handlers
*/
struct BOOST_SYMBOL_VISIBLE
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
route_params : route_params_base
{
/** The complete request target
Expand Down Expand Up @@ -180,7 +180,7 @@ post(F&& f) -> route_result
if(task_)
detail::throw_invalid_argument();

struct BOOST_SYMBOL_VISIBLE
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
immediate : detacher::owner
{
route_result rv;
Expand All @@ -193,7 +193,7 @@ post(F&& f) -> route_result
}
};

class BOOST_SYMBOL_VISIBLE model
class BOOST_HTTP_PROTO_SYMBOL_VISIBLE model
: public task
, public detacher::owner
{
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http_proto/server/router_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using route_result = system::error_code;

These values determine how the caller proceeds after invoking
a route handler. Each enumerator represents a distinct control
action—whether the request was handled, should continue to the
action�whether the request was handled, should continue to the
next route, transfers ownership of the session, or signals that
the connection should be closed.
*/
Expand Down Expand Up @@ -111,7 +111,7 @@ struct is_error_code_enum<
namespace http_proto {

namespace detail {
struct BOOST_SYMBOL_VISIBLE route_cat_type
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE route_cat_type
: system::error_category
{
BOOST_HTTP_PROTO_DECL const char* name() const noexcept override;
Expand Down Expand Up @@ -162,7 +162,7 @@ class detacher
public:
/** Base class of the implementation
*/
struct BOOST_SYMBOL_VISIBLE
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
owner
{
BOOST_HTTP_PROTO_DECL virtual resumer do_detach();
Expand Down
3 changes: 2 additions & 1 deletion include/boost/http_proto/sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace http_proto {
@ref source,
@ref parser.
*/
struct BOOST_HTTP_PROTO_DECL
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
sink
{
/** The results of consuming data.
Expand Down Expand Up @@ -188,6 +188,7 @@ struct BOOST_HTTP_PROTO_DECL
@param more `true` if there will be one
or more subsequent calls.
*/
BOOST_HTTP_PROTO_DECL
virtual
results
on_write(
Expand Down
3 changes: 2 additions & 1 deletion include/boost/http_proto/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace http_proto {
@ref sink,
@ref serializer.
*/
struct BOOST_HTTP_PROTO_DECL
struct BOOST_HTTP_PROTO_SYMBOL_VISIBLE
source
{
/** The results of producing data.
Expand Down Expand Up @@ -191,6 +191,7 @@ struct BOOST_HTTP_PROTO_DECL
indicate failure or that no more
data remains (or both).
*/
BOOST_HTTP_PROTO_DECL
virtual
results
on_read(
Expand Down
Loading