Conversation
ef14579 to
7fcf4a4
Compare
| module; | ||
|
|
||
| #include <asio.hpp> | ||
| #include <asio/ssl.hpp> | ||
|
|
||
| export module asio; |
There was a problem hiding this comment.
NOTE: the asio module
but MSVC does not compile it:
[5/8] Building CXX object CMakeFiles\asio_module.dir\D_\a\asio\asio\asio\stagedir\lib\cmake\asio\module\asio.cppm.obj
asio.cppm
Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
- add -D_WIN32_WINNT=0x0601 to the compiler command line; or
- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
D:\a\asio\asio\asio\stagedir\include\asio/detail/impl/win_mutex.ipp(39): note: sorry: 'inline' function definition for
'int asio::detail::win_mutex::do_init(void)' could not be written to module due to unrecognized expression
or statement at 'D:\a\asio\asio\asio\stagedir\include\asio/detail/impl/win_mutex.ipp(55)'.
If possible please provide a repro here: https://developercommunity.visualstudio.com/1dce944 to
3de812a
Compare
33e17ec to
47d4cd3
Compare
Windows makes me crazy: |
a06ec59 to
3846d69
Compare
|
I encountered and reported the first error you mention: https://developercommunity.visualstudio.com/t/Using-__try-in-an-inline-function-in-a-h/10186252 |
|
Thank you! |
| } | ||
| __except(GetExceptionCode() == STATUS_NO_MEMORY | ||
| ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) | ||
| catch (const std::bad_alloc&) |
There was a problem hiding this comment.
@anarthal This was my quick solution for ths MSVC inline problem
There was a problem hiding this comment.
Looks like GitHub had an issue yesterday, I got some 500 errors when trying to post my comments.
This doesn't do what you'd expect. SEH __catch clauses do catch C++ exceptions, but C++ catch doesn't catch SEH exceptions AFAIK. There's no std::bad_alloc exception in SEH to begin with.
If I'm not mistaken, the SEH handler there is only relevant for Windows XP/Windows Server 2003 and previous versions (see the InitializeCriticalSection docs). I don't think you can target these systems with a C++20 compiler, so you can likely remove the SEH try/catch in your prototype without loss of functionality.
| } | ||
| __except(GetExceptionCode() == STATUS_NO_MEMORY | ||
| ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) | ||
| catch (const std::bad_alloc&) |
There was a problem hiding this comment.
@anarthal This was my quick solution for ths MSVC inline problem
|
The remaining problem seems a const problem to be: cannot convert argument 1 from 'asio::this_coro::executor_t' to 'const asio::any_io_executor &' |
|
I got the |
|
The other issue you're seeing is likely due to this warning you're getting: Which is related to this: Actually, Asio declares them as This, however, relies on |
|
By the way, what is your final intention with this repository? Are you planning to PR it to Asio, or is it just to experiment? |
Both, but no success to add cmake support to the asio cmake PR But a a site effect, I created I found a better way and dit it for boost, fmt, asio: a cmake adapter to improve the cmake support. i.e. |
86564b7 to
52218d3
Compare
665554b to
b79ecbc
Compare
Add and use cmake workflow presets file Add CMAKE_VERIFY_INTERFACE_HEADER_SETS Use ccache if available
Install cmake config package to <prefix>/lib Install files less verbose Add examples to cmake project Use debug postfix for install asio library
Add wrapper for CXX_MODULES The example module test needs oppenssl
MSVC supports CXX_MODULES too, give it a try
Fix install prefix Use developer command prompt on Windows
use try {} catch() {}
Use ssl::error::make_error_code() Be less pedantic on Windows
1953ae3 to
29f4646
Compare
cmake workflow presetsfileCMAKE_VERIFY_INTERFACE_HEADER_SETSccacheif availableCXX_MODULECXX_MODULEsupport yet!)CXX_MODULE)find installed CXX_MODULEtest on CI!macOSwith both versions?see too https://anarthal.github.io/cppblog/modules2