Re: Create a self contained object file like fat jars from java
On 15/01/2024 1:23 AM, pizza_dox_ wrote: On Sunday, 14 January 2024 at 11:54:09 UTC, Richard (Rikki) Andrew Cattermole wrote: On 15/01/2024 12:47 AM, pizza_dox_ wrote: OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation. My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases. Thank you for the clarification. Are such things as string so platform dependent in d or the stuff for the class and interface declarations that they aren't cross platform? I meant the gcc used by the n64 toolchain (libdragon). A string in D is a slice. A pointer + length. This is entirely platform agnostic. A dynamic array, is a slice, backed by the GC. This requires the GC and with that druntime. Which means you cannot append to a slice without druntime. Classes require a ton of infrastructure to work. They are not purely a compilation construct.
Re: Create a self contained object file like fat jars from java
On Sunday, 14 January 2024 at 11:54:09 UTC, Richard (Rikki) Andrew Cattermole wrote: On 15/01/2024 12:47 AM, pizza_dox_ wrote: OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation. My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases. Thank you for the clarification. Are such things as string so platform dependent in d or the stuff for the class and interface declarations that they aren't cross platform? I meant the gcc used by the n64 toolchain (libdragon).
Re: Create a self contained object file like fat jars from java
On 15/01/2024 12:47 AM, pizza_dox_ wrote: OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation. My understanding is druntime is not ported to that platform. Too limited in resources. Getting a static library with all dependencies would not help you here. But yes, GCC does understand D, using GDC which is built on top (same frontend as DMD and LDC). You are either stuck using -betterC which does not support ``extern(D)`` classes, but does have ``extern(C++)`` classes. Or by using a custom runtime which you will likely have to write yourself and will likely break between compiler releases.
Re: Create a self contained object file like fat jars from java
OK to make it clear. I wanted to call d from c so that I can write a n64 game with d. But compiling the d object files while using higher features like classes, resulted in missing dependencys. So because GCC doesnt understands d I need an object file which has everything included d needs to run. Thats my understanding of this situation.
Re: Create a self contained object file like fat jars from java
On 15/01/2024 12:42 AM, pizza_dox_ wrote: On Sunday, 14 January 2024 at 10:05:12 UTC, Richard (Rikki) Andrew Cattermole wrote: On 08/01/2024 7:14 AM, Renato wrote: On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_ wrote: [...] Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`. Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library. But thats what I need and want. Combining of static libraries is not specific to D. Although you're going to need to figure out how to get a list of all the static libraries you want to combine. The actual combination should be pretty standard.
Re: Create a self contained object file like fat jars from java
On Sunday, 14 January 2024 at 10:05:12 UTC, Richard (Rikki) Andrew Cattermole wrote: On 08/01/2024 7:14 AM, Renato wrote: On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_ wrote: [...] Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`. Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library. But thats what I need and want.
Re: Create a self contained object file like fat jars from java
On 08/01/2024 7:14 AM, Renato wrote: On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_ wrote: Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_ Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`. Dub's static library target type does not include dependencies or druntime/phobos. Typically static libraries do not combine to produce a bigger static library.
Re: Create a self contained object file like fat jars from java
On Sunday, 14 January 2024 at 09:36:16 UTC, pizza_dox_ wrote: On Sunday, 7 January 2024 at 18:14:12 UTC, Renato wrote: On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_ wrote: Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_ Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`. Thank you for the information. Sadly nothing for gdc directly. But how is dub solving my problem? Is the buildstep creating a "fat jar". So instead of compiling multiple .d files with gdc I would only compile the "fat jar" from dub? I think you misunderstood me. `dub` is the D's build system and it "knows" how to call the D compilers, including gdc. When you tell dub to build a static library (equivalent to "fat jar" for D) it will use whatever compiler options are needed to do so... you can run `dub build -v -release --compiler=gdc` to see which compiler options it's using to invoke gdc, and then you can just drop dub if you don't need it (though it's very useful to have).
Re: Create a self contained object file like fat jars from java
On Sunday, 7 January 2024 at 18:14:12 UTC, Renato wrote: On Friday, 5 January 2024 at 22:10:31 UTC, pizza_dox_ wrote: Hi, I am trying with gdc to create the equivalent of a fat jar. So for that I would need the standard dlang library included in the object or library file. Does somebody know the needed gdc flags? I am using mips64-linux-gnuabi64-gdc-12. pizza_dox_ Did you try using dub and specifying `targetType="staticLibrary"`? See https://dub.pm/dub-reference/build_settings/#targetpath Even if you just want the right flags, this could help as you can "ask" dub to print the flags it's using with `dub build -v`. Thank you for the information. Sadly nothing for gdc directly. But how is dub solving my problem? Is the buildstep creating a "fat jar". So instead of compiling multiple .d files with gdc I would only compile the "fat jar" from dub?