digitalmars.D.learn - Make executable archive just like Java's .jar archive?
- BoQsc (2/2) Sep 12 2019 Is there a way to archive multiple .d source code files and make
- BoQsc (2/4) Sep 12 2019 https://en.wikipedia.org/wiki/JAR_(file_format)
- Mike Parker (21/25) Sep 12 2019 A JAR file is just a standard zip file. The Java Virtual Machine
- norm (8/10) Sep 12 2019 You can achieve something similar with rdmd and shell;
Is there a way to archive multiple .d source code files and make that archive executable, or something similar?
Sep 12 2019
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote:Is there a way to archive multiple .d source code files and make that archive executable, or something similar?https://en.wikipedia.org/wiki/JAR_(file_format)
Sep 12 2019
On Thursday, 12 September 2019 at 12:53:27 UTC, BoQsc wrote:On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote:A JAR file is just a standard zip file. The Java Virtual Machine loads .class files (which are Java bytecode files, not Java source) and executes them at runtime. It doesn't matter if they're in a jar file or not. Java was designed for this from the beginning. If you're really talking about loading .d *source* files, that means they either have to be interpreted like a scripting language, in which case you'll need a D interpreter, or they'll need to be compiled at runtime into bytecode (in which case you'll need a bytecode interpreter), or compiled at runtime into object files, in which case you'll need a mechanism for loading object files into a program (there was an object loader library around back in the D1 days). If you want to do what Java does and compile ahead of time to a bytecode format and distribute the bytecode in an archive to be loaded at runtime, then that requires implementing a bytecode compiler, a loader, and a bytecode interpreter. I know that LLVM can output bytecode, so with LDC that's the first step out of the way. Now all you need is for someone to implement a loader and bytecode interpreter.Is there a way to archive multiple .d source code files and make that archive executable, or something similar?https://en.wikipedia.org/wiki/JAR_(file_format)
Sep 12 2019
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote:Is there a way to archive multiple .d source code files and make that archive executable, or something similar?You can achieve something similar with rdmd and shell; $ tar -zcvf source_files.tar.gz source1.d source2.d ... sourceN.d $ rdmd $(tar -xvf source_files.tar.gz) I imagine it wouldn't take much for rdmd to support ZIP or tarballs directly but I'm sure there are corner cases to consider. Bye, norm
Sep 12 2019