lithium
lithium copied to clipboard
Support Windows
It would lift the library to the next level.
Windows Server 2019 is perfectly capable for server programs!
Hi @FastInvite2k2 ,
This is something we can investigate. I don't know much about the windows networking and async IO API but I can have a look. The only part that requires a rewrite for windows is the async TCP server, and it's seems possible reading this:
- https://stackoverflow.com/questions/67082/what-is-the-best-epoll-kqueue-select-equvalient-on-windows.
- https://cfsamsonbooks.gitbook.io/epoll-kqueue-iocp-explained/appendix-1/iocp
If anyone has experience with windows network programming, help is welcome!
You could add support for libuv and have async I/O for all relevant platforms!
Does it already function via WSL2?
I never tried but it should no? Is there any program running on linux that does not run under WSL2 ?
I'm curious if li::sql has been tested under Windows. I like the look of the API.
It used to be but not anymore (I guess few compilation errors has to be solved first). Several people asked for windows/macos support so I'll set this as my priority.
I wonder if this might help speed up a windows port? https://github.com/piscisaureus/wepoll
"This library implements the epoll API for Windows applications. It is fast and scalable, and it closely resembles the API and behavior of Linux' epoll."
Thanks @ckaminski this looks great. I think use wepoll to quickly get windows support.
I started working on it but it seems like there is a bug in the MSVC compiler. The following code fails to compile and I can't find any workaround:
template <typename... Ms> struct metamap;
template <typename M1, typename... Ms> struct metamap<M1, Ms...> : public M1, Ms... {
metamap(typename M1::test_type&& m, typename Ms::test_type&&... x) {}
};
int main() {}
example.cpp
<source>(14): error C3543: 'metamap<M1,Ms...>::Ms::test_type &&': does not contain a parameter pack
<source>(15): note: see reference to class template instantiation 'metamap<M1,Ms...>' being compiled
Compiler returned: 2
I sent a bug report hope they will fix it pretty soon... https://developercommunity.visualstudio.com/content/problem/1203865/c-compilation-bug-parameter-pack-in-constructor-wi.html
Since we'll probably have to wait for quite some time for the MSVC bug to get fixed. I'll delay windows support to an future release.
The following workaround seems to compile, tested using Compiler Explorer:
template <typename... Ms> struct metamap;
template <typename M1, typename... Ms> struct metamap<M1, Ms...> : public M1, Ms... {
template <typename M>
using TestType = typename M::test_type;
metamap(TestType<M1>&& m, TestType<Ms>&&... x);
};
int main() {}
Thanks @chausner ! Seems like this unblock the progress on the windows support.
Would you use boost::asio as the network backend for cross platform?
Would you use boost::asio as the network backend for cross platform?
Although would make things somewhat "easier", it also carries a lot of baggage, it has many issues on its own, and being honest, I think lithium is great exactly because of that lack of baggage, it just adds the dependencies that are absolutely needed for doing what it does, and nothing more, which in part is what contributes to its success.
I support doing things adaptive instead of prescriptive, implement just what you need and nothing more, rather than including a library or framework and working around shoehorning the app into such dependencies.
template<class M> struct m_traits { using iod_value_type = typename M::_iod_value_type; };
constexpr inline metamap(typename m_traits<M1>::iod_value_type &&m1, typename m_traits<Ms>::iod_value_type &&... members) : M1{m1}, Ms{std::forward<typename m_traits<Ms>::iod_value_type>(members)}... {} constexpr inline metamap(M1 && m1, Ms && ... members) : M1(m1), Ms(std::forward<Ms>(members))... {} constexpr inline metamap(const M1 & m1, const Ms & ... members) : M1(m1), Ms((members))... {}
// Assignemnt ?
// Retrive a value.
template <typename K> constexpr decltype(auto) operator[](K k) {
return symbol_member_access(*this, k);
}
fix windows build template error
Thanks @vanehu the master branch now compile on windows but there is still bugs. I'll work more on this later.