r/cpp • • Jul 23 '22

finally. #embed

https://thephd.dev/finally-embed-in-c23
353 Upvotes

202 comments sorted by

View all comments

4

u/FightingGamesFan Jul 23 '22

Very naive question but I'm not sure to understand the benefit of embedding "big" resources at compile time (big as in it would not be practical to embed it in an array/string as described in the article).

Can someone give an example where it's strongly needed?

16

u/Mikumiku_Dance Jul 23 '22

I have a small program that edits epub books. I'd like to insert a particular image into the epubs as well. Right now i just distribute the exe and the jpg and tell users to pass arguments, but for the common case it'd sure be nice to just distribute a single file exe.

GTK programs bundle all sorts of stuff in their executables, like css themes, images, and xml ui definitions.

I don't know how strict you feel "strongly needed" is, but i hope these mundane circumstances are enough for you to accept a preprocessor directive that doesn't hurt anybody not using it.

1

u/xDarKraDx Jul 23 '22

Sorry this is off topic.

I'm also looking for a way to automate editing my epub library, especially editing the metadata fields like "belong to collection", "position in group", etc. Do you have any recommend read or library to handle that?

I don't know much about epub file structure itself. I usually just edit them by hand using Sigil and it takes forever.

→ More replies (4)