New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO.select fails on MSVC #5659
Comments
Unfortunately, mruby-socket assumes sockets can be represented by file descriptors (as UNIX does), but it's not true for WIN32 system using MSVC. CRuby implements an emulation layer on top of Windows socket. But it's not affordable for us. Your options are:
Our (future) options are:
What's your opinion? |
I see, that is unfortunate; I'll try using MSYS. In the short term it would be good if it threw a descriptive error on MSVC that it isn't supported. |
Will do, but I need to find a macro symbol to distinguish MSVC first ( |
The ignorance of the Windows platform with the arrogance to call mruby cross platform is unfortunately still high. I tried to raise this point 15 year ago but nobody listened. There would be quite a few API changes required. For example symlink on windows depends if it is a symbolic link to a file or a directory and the caller has to know this before invoking symlink, so two new functions are required. Just one more example. I burned out 10 years ago to talk about it, it's worthless as long as there is no shift in mentality. mruby could be such a nice embedded language if it would be written with more openess and less unix in mind. Using MSYS is not a solution. There are still many things that require to use visual studio compiler and the whole new Windows Application SDK is not going to be able to use gcc/clang despite all the attempts another subgroup at Microsoft made to bring clang to windows. |
I agree with you. We need more contributors with Windows knowledge to be "real" cross-platform. |
If you feel a bit adventurous you could try compiling mruby with https://github.com/jart/cosmopolitan. |
I'm trying to use
IO.select
to monitor sockets; It works on CRuby but crashes on MRuby.Script
https://github.com/cyberarm/broadcast_forwarder_wireguard/blob/e50413f37070cdaf88795a06d1f4a18c26bc09b0/broadcast_forwarder_wireguard.rb
I added a
printf("WSAGetLastError: %i\n", WSAGetLastError());
inside ofmruby/mrbgems/mruby-io/src/io.c
Line 1261 in 1508da4
According to
WSAGetLastError()
its caused byWSAEINVAL
https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
Backtrace
Build Config
The text was updated successfully, but these errors were encountered: