On Sun, 02 Feb 2014 10:52:37 -0600, bearophile <[email protected]> wrote:

Gary Willoughby:

I'm using DMD to create an executable and wondered what is the best way to embed data into it.

For example, i want to embed base64 image data in the executable then access it during runtime. Is this possible? if so how?

There are various ways to do it. If your data is not too much, one way is to use a "hex string". You can also use mixin(import("...")).

Bye,
bearophile

What's the purpose of the mixin portion of that? The documentation for file imports say that `import("...")` produces a string, so `__gshared immutable myFile = Base64.encode(import("myFile"));` should work perfectly, provided "myFile" is in a path passed to dmd with the -j switch.

Reply via email to