Live data from Hacker News

Cosmopolitan Libc: build-once run-anywhere C library

justine.lol

161–170 of 171 posts

Re: Cosmopolitan Libc: build-once run-anywhere C library

#161
post #67
post #44

Earlier quoted context omitted.

Author here. That's not an inherent limitation. See https://justine.lol/apelife/index.html for an example of a GUI + TUI that's built using Cosmopolitan. The reason why I said what you quoted, is I'm simply trying to calibrate expectations. I don't view desktop GUIs as a productive area of focus, because there's such a lack of consensus surrounding the APIs that requires, and web browsers do a great job. As for sizeo…

Regarding consensus desktop APIs, maybe it's time to re-invent/-introduce Win32s ;) (Although adding that to the library would add considerable bloat, and cross-platform runtime dynamic linking or a "dynamic polyfill" might be a bit beyond the scope of this) Or raw X11 protocol, of course (WSL made X11 servers on Win10 quite common, and . If that wouldn't be so horrible, it would be interesting how small one could ge…

I have used XWin32 and Hummingbird since 2000.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#163
post #34

Earlier quoted context omitted.

Author here. WebAssembly has played an important role protecting CI on the Internet and it's cool that it enables us to run LLVM in the browser. I was very surprised when I learned that some people were using it offline outside of browsers, since doing so requires a JVM-like runtime such as wasmtime. Cosmopolitan proves that it's possible to just fix C instead, which might fix all the stuff that's built on top of C t…

excuse my ignorance on this, but this sounds amazing. game changing. yet it's being "served" here on ice. casually. what am I missing?

Portability was a long desired attribute of computer software up until it turns out that it doesn't matter at all.

When software was deployed on floppy disks and there were 10k architectures going around, portability was critical to expand the market reach of any distributed software.

But in the modern age when the software runs "in the cloud" and there are dominant platforms out there, turns out that portability doesn't matter - nobody is changing platforms when they don't need to.

So this makes this achievement a pretty cool demo without any industry impact, since people don't distribute C binaries anymore.

The idea behind it and the technology developed is pretty cool :)

Re: Cosmopolitan Libc: build-once run-anywhere C library

#164

Earlier quoted context omitted.

What is a way to fix this? Is this some part of an endless long-cycle of adoption for social networks over some kind of crossing-the-chasm style adoption curve? Or is there a structural way to fix it? Stackoverflow is better than its predecessors, but clearly is much less valuable now than for its first few 5 years or so.

It's not just that social networks go bad the way cheese goes bad, but also that any "social network" business becomes opposed to the interests of its user base at the moment it becomes a "sustainable" business (e.g. the users would want 100% of the surplus to go to improving the system, but management, employees, investors and such won't agree) Once you are #1 in the Google Economy there are many reasons to say "why…

You just reminded me of The Well.

I had the notion their membership was limited, like a country club or fraternity or something, to a fixed number. To join, someone else had to first leave. I can't now confirm this, so I probably misremembered. Regardless, I've always liked this idea.

Wiki claims a distinction between virtual communities and social medias. The Well, MetaFilter, Ravelry and others have membership fees. Some have verified identities. Those frictions would certainly deter most dysfunction, antisocial behaviors now plaguing social medias.

I think curated social media is mostly fruitless. Having done a lot of online moderation, I honestly don't know how u/dang and others pull it off.

Culture and civility is much easier with preventative measures, like verified identity.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#165
> So what Cosmopolitan does for memcpy() and many other frequently-called core library leaf functions, is defining a simple macro wrapper, which tells the compiler the correct subset of the abi that's actually needed

By not marking all memory as clobbered for a call to memcpy, couldn't the memcpy overwrite a local variable, in which case reads post memcpy could miss the updated value?

> The above two compiles used the same gcc flags

Why does the before have frame pointers and post does not?

Re: Cosmopolitan Libc: build-once run-anywhere C library

#166

Earlier quoted context omitted.

Speaking as someone who would love to see WebAssembly succeed as a cross-platform, cross-language way for me to write sandboxed plugins and CLI utilities, I do have to point out that, for out-of-browser use, WASM's MVP does regress various things: * https://00f.net/2018/11/25/webassembly-doesnt-make-unsafe-la... * https://www.usenix.org/system/files/sec20-lehmann.pdf (eg. Under WebAssembly's memory model, dereferenci…

> Under WebAssembly's memory model, dereferencing NULL=0 won't lead to a segfault. Thanks that's a curious one. It won't always lead to a segfault with a conventional compiler either, undefined behaviour being what it is. [0][1] Fortunately GCC can be asked to add such checks at runtime, [2] this approach could also be taken with WebAssembly. [0] https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=63... [1] htt…

I was more referring to how it's standard practice on modern OSes to leave the zero page unmapped in a process's address space so that, if the compiler converts the NULL dereference into a dereference of address 0x0, it'll trigger a segfault.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#169
post #149
post #147

Any chance this could be made to work with tcc instead of gcc on Windows? I don't understand enough of how it is tied into gcc and linux to even take a shot at it.

Author here. tcc is tired and chibicc is wired. Check out https://github.com/jart/cosmopolitan/blob/master/third_party... where I've been working on building a 300kb actually portable executable c11 compiler + assembler + linker that supports all the best gnu extensions.

Wow, I'll have to look at chibicc in detail. Sounds great!

Re: Cosmopolitan Libc: build-once run-anywhere C library

#170

Impressive and well written article. But unfortunately I get an error message when attempting to run from a cmd line in Windows 10. C:\Users\Foo>emulator.com -t life.com "This app can't run on your PC" Maybe I missed something?

That's an old version of the emulator from the APE blog post back in August. Download blinkenlights.com which should work fine in the windows command prompt. https://justine.lol/blinkenlights/index.html
Post reply on HN