chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.81k stars 1.2k forks source link

Exception when creating io_context in MacOS dylib #1277

Open alexbeattie42 opened 1 year ago

alexbeattie42 commented 1 year ago

When creating an io_context inside a MacOS dylib that is linked to a plugin in Unreal Engine an exception occurs.

More details can be found in the following related posts: boost asio crash asio dlib crash

From the SO post the fix also works for this library: The address to the service_registry::create static factory method resolves correctly when ASIO_DECL is added in front of the methods declaration in asio/detail/service_registry.hpp.

It should look like this:

// Factory function for creating a service instance.
template <typename Service, typename Owner>
ASIO_DECL static execution_context::service* create(void* owner);