News for hackers. Stuff that matters.
Re:Zig is now also a Windows resource compiler by rational_indian on Saturday October 21, 2023 @03:33PM (#37969848)
I wish linux had a comparable system for systematically embedding assets in binaries.
Re:Zig is now also a Windows resource compiler by jasaldivara on Saturday October 21, 2023 @04:10PM (#37970067)
There are GResources for the GTK/GObject ecosystem:

https://docs.gtk.org/gio/struct.Resource.html

Re:Zig is now also a Windows resource compiler by pjmlp on Saturday October 21, 2023 @05:50PM (#37970791)
With C23 and C++23, you can make use of #embedd for similar purposes.
Re:Zig is now also a Windows resource compiler by intelVISA on Saturday October 21, 2023 @06:03PM (#37970886)
Interesting, is #embed actually in C++23? From my gcc8 tomb I thought such delights were for the Chosen Few who write beautiful C23.
Re:Zig is now also a Windows resource compiler by pjmlp on Sunday October 22, 2023 @02:59AM (#37973409)
And 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.

Re:Zig is now also a Windows resource compiler by KingLancelot on Saturday October 21, 2023 @08:27PM (#37971785)
#Embed is in C23, std::embed is hopefully coming in C++26.
Re:Zig is now also a Windows resource compiler by pjmlp on Sunday October 22, 2023 @02:57AM (#37973403)
I stand corrected.
Re:Zig is now also a Windows resource compiler by layer8 on Sunday October 22, 2023 @07:47AM (#37974548)
Win32 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/...

Re:Zig is now also a Windows resource compiler by starttoaster on Saturday October 21, 2023 @06:06PM (#37970902)
You can embed assets into a binary with Go https://blog.jetbrains.com/go/2021/06/09/how-to-use-go-embed...
Re:Zig is now also a Windows resource compiler by begoon on Saturday October 21, 2023 @06:54PM (#37971234)
This 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.
Re:Zig is now also a Windows resource compiler by o11c on Saturday October 21, 2023 @06:34PM (#37971113)
You 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).
Re:Zig is now also a Windows resource compiler by fleventynine on Saturday October 21, 2023 @08:23PM (#37971755)
Embedding binary data should be part of the language/toolchain, not the operating system. For example, include_bytes!() in Rust.
Re:Zig is now also a Windows resource compiler by sebazzz on Sunday October 22, 2023 @01:45AM (#37973102)
This is embedding in the way the operating system can find it.
Re:Zig is now also a Windows resource compiler by lmz on Sunday October 22, 2023 @08:25AM (#37974747)
As long as you can open your own executable for reading what does the OS have to do with this?
Re:Zig is now also a Windows resource compiler by biaachmonkie on Sunday October 22, 2023 @01:49PM (#37977514)
Icons are the most common use case I'd think. But several other things that could be indexed, information about the application, etc...
Re:Zig is now also a Windows resource compiler by lmz on Sunday October 22, 2023 @10:49PM (#37981067)
Yeah 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.
Re:Zig is now also a Windows resource compiler by rational_indian on Tuesday October 24, 2023 @03:24PM (#38004058)
Don'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.