Hi , so basically for C/C++ apps we can use cygwin to use linux header and etc without using underlying windows api . is it possible to do the same with Rust using cygwin? so i just use libc crate for all i need
Rusts standard library already handles platform compatibility pretty well. What do you want to do? Do you find std
insufficient?
Thats true but im talking about libc crate , it provides POSIX API bindings for Rust . So i was thinking of if we would be able to use cygwin with Rust libc crate would handle many stuff on Windows too
Getting Cygwin to work with Rust would likely require adding a new target next to x86_64-pc-windows-msvc and x86_64-pc-windows-gnu. Cygwin uses a lot of hacks to try to implement the POSIX api's on top of a system that does many things a lot differently. For example fork is fundamentally incompatible with many Windows system libraries.
For Rust rather than trying to use POSIX api's on non-POSIX systems, the expected way to achieve portability is to avoid directly interfacing with the libc crate directly and instead use crates that abstract over the OS, like the standard library, like libloading in the place of dlopen, memmap2 in the place of mmap and fd-lock for locking files.
edit: it got merged! There is a cygwin support now.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.