3 ms·
Typing me some Nim and shaking my head. Passing -static to the linker, I get neat, robust, non-dynamic executables, typically in the low MB or even kB size-rang
by interfixus 8y ago
Typing me some Nim and shaking my head.
Passing -static to the linker, I get neat, robust, non-dynamic executables, typically in the low MB or even kB size-range.
const varname = staticRead"filename" embeds a given resource at compile time - to make the project completely selfcontained if need be, and just for the hell of it.
I know you can do this in several other languages, but the Nim way is - unsurprisingly - the most ready-made, obvious and transparent one I've come across.
- rkeene2 8y agoTcl beats it in terms of both transparency and ready-made-ness. In Tcl, all filesystem access goes through the Tcl Virtual Filesystem (VFS) layer. This is a layer of indirection that allows for the interpreter, including at the script-level, to intercept filesystem calls and replace them with their own data. The default (and catch-all) driver is called "native" that just passes things to the native OS, but you can write other drivers and over the decades people have done so. The most popular one is Starkit/Starpack which uses the Metakit database (which is a heirarchial database) and appends that archive to a loader (either a script, as a stub, or to an executable which includes the stub with the ability to open itself). This database can be modified externally using the starkit tools (sdx), and when you pack all your resources into it, it appears from within the interpreter that all the files are just normal files even though only the database is being accessed.
- interfixus 8y agoTcl is still a breath of fresh air, here 30 years after it first appeared. Such a pity all the minshare it has lost.
- rkeene2 8y agoAnd it can now be compiled to machine code (TclQuadCode), an amazing feat which should have further information presented at this year's Tcl conference (already underway).
- interfixus 8y agoSeriously? (well, yes, I did a search). Clearly, I haven't been paying the attention I should, so thank you, this is super exciting.