Embed files into binary.

Pie? via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 5 19:05:09 PDT 2016


I saw somewhere someone explaining how to embed resources into a 
binary using the import keyword.

I believe the essentially converted the file into a ubyte or 
something and then wrote that out to a temp file and read in the 
temp file... this seems a bit of a kludge to me.

Is it possible to do the same, but create a sort of "in memory" 
file layout?

While I can modify my own routines to read the "file" from 
memory, I can't do that easily with outside code(I could modify 
the binaries).

Basically reading a file has to read it to memory, and if the 
file data already exists in memory, there is no point to read, 
just get it direct.

Any thoughts on this?

Because D allows such an embedding feature, maybe the file system 
should allow working with this concept? That way, it becomes VERY 
easy to embed files into the binary and work with them like they 
wernt. Also, going between the two different versions(embedded vs 
not) could be done with version (Release).








More information about the Digitalmars-d-learn mailing list