4 ms·
I wish linux had a comparable system for systematically embedding assets in binaries.
by rational_indian 3y ago
I wish linux had a comparable system for systematically embedding assets in binaries.
- jasaldivara 3y agoThere are GResources for the GTK/GObject ecosystem: https://docs.gtk.org/gio/struct.Resource.html https://docs.gtk.org/gio/struct.Resource.html
- pjmlp 3y agoWith C23 and C++23, you can make use of #embedd for similar purposes.
- intelVISA 3y agoInteresting, is #embed actually in C++23? From my gcc8 tomb I thought such delights were for the Chosen Few who write beautiful C23.
- pjmlp 3y agoAnd me thinking having GCC 10 as default on cloud shells was already bad enough. I was wrong on C++ side, apparently it is on track for C++26.
- KingLancelot 3y ago#Embed is in C23, std::embed is hopefully coming in C++26.
- pjmlp 3y agoI stand corrected.
- layer8 3y agoWin32 resources are much more than that. They have names and type information associated with them, and they can be multilingual (see e.g. [0]). A rich runtime API is provided to dynamically find and load resources from executables/libraries. You can distribute a resource library that other programs can statically link in or dynamically load. Basically, it’s an ABI for resources, including localization support and a schema for UI-related resource types. [0] https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-findresourceexa https://learn.microsoft.com/en-us/windows/win32/api/winbase/...
- starttoaster 3y agoYou can embed assets into a binary with Go https://blog.jetbrains.com/go/2021/06/09/how-to-use-go-embed-in-go-1-16/ https://blog.jetbrains.com/go/2021/06/09/how-to-use-go-embed...
- begoon 3y agoThis feature of Go tool chain is so underrated. Yes, there is nothing magical here. I can achieve similar outcome with some custom preprocessing, but having it built into the ecosystem, with type checking and inferencing, single binary compilation, etc. is a great productivity booster.
- o11c 3y agoYou can use `objcopy`, `as`, or `ld`. There are several ways, some of which even allow setting the symbol size (which most people never care about, but sometimes matters for nerds introspecting your object files).
- fleventynine 3y agoEmbedding binary data should be part of the language/toolchain, not the operating system. For example, include_bytes!() in Rust.
- sebazzz 3y agoThis is embedding in the way the operating system can find it.
- lmz 3y agoAs long as you can open your own executable for reading what does the OS have to do with this?
- biaachmonkie 3y agoIcons are the most common use case I'd think. But several other things that could be indexed, information about the application, etc...
- lmz 3y agoYeah but the original post was talking about "Linux" which doesn't really have any use for that on the kernel level. I also doubt Freedesktop are going to specify special ELF sections or something for icons.
- rational_indian 3y agoDon't care if the kernel needs it or not. I care about the things for which Windows uses it. Why is the icon a separate file on Linux? > I also doubt Freedesktop are going to specify special ELF sections or something for icons They should. It would stop my icons from disappearing / changing on me while Iam not looking.