Skip to content
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

cosmopolitan binaries experiment? #77

Open
coderofsalvation opened this issue Apr 20, 2023 · 4 comments
Open

cosmopolitan binaries experiment? #77

coderofsalvation opened this issue Apr 20, 2023 · 4 comments

Comments

@coderofsalvation
Copy link

Any thoughts on cosmopolitan libc and microwindows?
A bit of a stretch?

@ghaerr
Copy link
Owner

ghaerr commented Apr 20, 2023

Hello @coderofsalvation,

Any thoughts on cosmopolitan libc and microwindows?
A bit of a stretch?

Actually, I have been working with @jart and last year put together a demo of the Nuklear immediate-mode GUI running on Microwindows as an APE Cosmopolitan executable. This is described in jart/cosmopolitan#35 (comment), jart/cosmopolitan#35 (comment) and jart/cosmopolitan#35 (comment).

This post shows how to compile a demo on Cosmopolitan. There's still some portability problems though, as while Cosmo supplies the abilities to run the C library across many platforms, the mouse and graphics support ends up (in this demo case at least) being marshaled across to another native host binary (a framebuffer emulator).

Tell me more about what you're interested in accomplishing and I'll try to help.

Thank you!

@coderofsalvation
Copy link
Author

coderofsalvation commented Apr 20, 2023

oh that is very cool to see. I'm going to re-read up on that thread (I recognize it from 1-2 years ago when I helped testing cosmogfx).
TBH I'm not really trying to accomplish anything (yet), I was more thinking that the maintainer of this repository has huge knowledge on slim crossplatform gui's (and perhaps wanted to connect you with @jart).
But it's great to hear that already happened!

By just looking swiftly at that thread, it seems that there's still a native binary needed to make ends meet.
Allow me to brainstorm a bit here: in theory, could there be multiple native host binaries (linux X11, macOS, windows e.g.) which could be zipped into the .com (like redbean) and extracted during runtime?

ps. what I really like about microwindows and cosmopolitan, is that it has a focus on portability & durability (a binary application which ages well over time). There doesn't seem to be much focus on that, so kudos for that.

@ghaerr
Copy link
Owner

ghaerr commented Apr 20, 2023

Allow me to brainstorm a bit here: in theory, could there be multiple native host binaries (linux X11, macOS, windows e.g.) which could be zipped into the .com (like redbean) and extracted during runtime?

Well, I suppose native host binaries could be encapsulated within a .com APE binary, but that kind of defeats the purpose of using the APE binary in the first place (and none of those native binaries would be linked with Cosmopolitan). The real problem is that there isn't a cross-platform standard for mouse events (that is, a mouse isn't handled directly by the OS, but instead by a GUI), and that while there is almost a portable way to access hardware video graphics using a framebuffer, the user may not actually be running in a framebuffer-compatble mode (that is, X11 could be running on non-fb graphics chip, or another windowing, GUI or TUI may be currently running).

Both the mouse and graphics drawing issues can be portably solved by using an SDL library layer in between the application and the OS/screen/mouse, but this usually means popping up an SDL window from which the application runs, and SDL is not yet ported to Cosmopolitan.

Thank you!

@coderofsalvation
Copy link
Author

Hm good points.
Going even deeper, we could say that we're stuck with the blind spots of POSIX
SDL would indeed be the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants