-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement System for Win32 #6972
Implement System for Win32 #6972
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows#bindings for naming in C bindings.
Also, you should put them in a file with the same file name as the C header filer (just with .cr
extension). Ditto for the other features in this file.
I think I hit all the PR comments with fixes in the latest push. Let me know if there's anything else. |
@markrjr This PR needs to address the review comments. |
I've got most of it done locally, but have not had time to finish the last bits. I'll commit by the end of the week. |
Looks great, @markrjr ! It still needs to be integrated with {% if flag?(:unix) %}
require "./system/unix/hostname"
{% if flag?(:freebsd) || flag?(:openbsd) %}
require "./system/unix/sysctl_cpucount"
{% else %}
require "./system/unix/sysconf_cpucount"
{% end %}
{% elsif flag?(:win32) %}
require "./system/win32/hostname"
require "./system/win32/cpucount"
{% else %}
{% raise "No Crystal::System implementation available" %}
{% end %} Specs would be nice. Unfortunately, As a workaround, the commands can be executed as macros. This means the spec will only pass when executed on the same machine as it was compiled. This works on WSL, but not when cross-compiling from a different machine. Such a hack should be put into the PR, but it serves for manual verification. Once On windows, the cpu count is actually available as environment variable |
Co-Authored-By: markrjr <markrjr@users.noreply.github.com>
Is there anything else to tackle here? @RX14 @straight-shoota @r00ster91 |
Neat! 🎉I will do a bit more of a dive into the language before I submit another PR, but thanks for all the help everyone! |
@markrjr You're initial patch wasn't bad. Keep it on! =) |
Thanks for the great first patch @markrjr 🎉 |
System methods have been implemented for win32 in crystal-lang#6972
System methods have been implemented for win32 in #6972
Pretty simple implementation of the hostname and cpu count functions.