Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This would be huge. I have had to deal with 3rd party libraries to try to embed assets for a web server.


Which is the way it should be. Not everything needs to be in std lib.


While I agree that "not everything needs to be in std lib", having worked with other languages that support embedding out of the box, let me tell you it's handy.

It also seems like an area where it'd be nice for there to be a single uniform way to do it.


Of all things C is missing the ability to import binary assets. Which is kinda deranged when you think about it.


For runtime, you can certainly read any arbitrary binary file in C without problems.

For compile time, I make heavy use of xxd -i to generate header files in a range of projects. It is no longer installed by default on most +nix systems, but it is generally still in your package manager (often installed alongside vim), and has been around since 1990.


Oh I wish I'd known about 'xxd -i' ! When I saw it in the video linked above I was so annoyed that I hadn't used it before


ISO C surely, C based SDKs on macOS and Windows do support embedding resources since 16 bit days.


Sure, but then it isn't guaranteed to work everywhere there is a compiler for the language.


The third party solutions have to resort to writing out source files, proper support in tooling can be much more efficient.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: