News for hackers. Stuff that matters.
Re:Baby Steps: Slowly Porting Musl to Rust by fpgaminer on Sunday June 12, 2016 @03:05PM (#11889706)
As a corollary to writing the C standard library in Rust, are there any plans by the Rust devs to remove the C standard library dependency itself? That, to me, is just as interesting of a proposition.
Re:Baby Steps: Slowly Porting Musl to Rust by pcwalton on Sunday June 12, 2016 @03:11PM (#11889738)
It's not a high priority task, no. (Though it would be quite interesting to see it done.)

On Windows and Mac OS X you shouldn't really avoid C libraries (kernel32.dll and libSystem.dylib respectively) because the syscall interface is considered a private API. (You can avoid it technically, and apps sometimes do, but Microsoft and Apple would be within their rights to break us at any time if we did that.)

Re:Baby Steps: Slowly Porting Musl to Rust by melloc on Sunday June 12, 2016 @10:22PM (#11891385)
In addition to Windows and Mac OS X, illumos and I believe all of the BSDs require you to use libc for the same reason. I'm sure that they exist, but I don't know of any kernels other than Linux where the syscall layer is a stable interface. (I'd love to learn about some others though, if anyone knows.)
Re:Baby Steps: Slowly Porting Musl to Rust by pjmlp on Monday June 13, 2016 @01:51AM (#11891927)
But those are technically the OS system calls, not libc.

Would the Rust team accept PR to remove the dependencies on libc for Windows?

Re:Baby Steps: Slowly Porting Musl to Rust by masklinn on Monday June 13, 2016 @03:45AM (#11892244)
> But those are technically the OS system calls, not libc.

They're libc calls, libSystem is the union of a bunch of libraries including libc. In fact, these unioned libraries are just symlinks to libSystem:

    libc.dylib -> libSystem.dylib
    libdbm.dylib -> libSystem.dylib
    libdl.dylib -> libSystem.dylib
    libgcc_s.1.dylib -> libSystem.B.dylib
    libinfo.dylib -> libSystem.dylib
    libm.dylib -> libSystem.dylib
    libmx.dylib -> libSystem.dylib
    libpoll.dylib -> libSystem.dylib
    libproc.dylib -> libSystem.dylib
    libpthread.dylib -> libSystem.dylib
    librpcsvc.dylib -> libSystem.dylib
Re:Baby Steps: Slowly Porting Musl to Rust by pjmlp on Monday June 13, 2016 @04:14AM (#11892320)
Still, isn't ironic that a systems programming language isn't able to be used without C, because its runtime was made to rely on libc instead of the raw OS APIs?

I understand the shortcut as a way to reduce development time, but maybe that is something to improve.

Go made the right decision by integrating directly with the OS APIs.

Re:Baby Steps: Slowly Porting Musl to Rust by claudius on Monday June 13, 2016 @04:48AM (#11892448)
> rely on libc instead of the raw OS APIs?

The argument here is that on Windows and Mac OS X, the libc library is the ‘raw OS API’ and it hence makes perfect sense to rely on it if you want to support such operating systems.

Re:Baby Steps: Slowly Porting Musl to Rust by bjourne on Monday June 13, 2016 @10:35PM (#11899392)
On Windows it isn't. Microsoft has made it clear that you aren't supposed to link to the msvcrt.dlls shipped in Windows. See https://sourceforge.net/p/mingw-w64/wiki2/The%20case%20again...
Re:Baby Steps: Slowly Porting Musl to Rust by pjmlp on Monday June 13, 2016 @05:37AM (#11892614)
If I want to zero memory on Windows without libc dependencies, I use ZeroMemory() or FillMemory() and not memset().

No need to have any dependency on msvcr*.dll or the equivalent for Borland, Intel and other Windows compilers, which are effectively the Windows libc.

Re:Baby Steps: Slowly Porting Musl to Rust by choosername on Monday June 13, 2016 @07:23AM (#11892923)
there is a baremetal rust os that avoids libc. I think it achieves this by avoiding the rust standard library.
Re:Baby Steps: Slowly Porting Musl to Rust by ben0x539 on Sunday June 12, 2016 @06:05PM (#11890520)
On Windows, does Rust currently require/use (nontrivial features of) the C standard library in addition to the C "win32"/"winapi"/w/e libraries?
Re:Baby Steps: Slowly Porting Musl to Rust by heinrich5991 on Sunday June 12, 2016 @06:25PM (#11890620)
The math library AFAIK, in order to provide the same wrong results that the MSVC implementation gives.
Re:Baby Steps: Slowly Porting Musl to Rust by adrianratnapala on Monday June 13, 2016 @10:58AM (#11894363)
Heh? Can you point to a description of the wrongness of MSVC maths.

I noticed that they were a bit slow to support infinities and NaN, but that is not the same thing a being wrong.

Re:Baby Steps: Slowly Porting Musl to Rust by steveklabnik on Sunday June 12, 2016 @03:10PM (#11889733)
So, with libcore, you don't have a libc dependency. With libstd, you do. There has been some interest in making it easier to port libstd away from it, but it would likely be a cross target, like musl itself, rather than an official move. We'll see what the future holds!