Including a file

Ali Çehreli acehreli at yahoo.com
Sun Jul 18 17:58:19 UTC 2021


On 7/18/21 10:28 AM, Vindex wrote:

 > ```
 > ldc2 source/main.d -ofmyprogram -L-l:libmylib.so.0
 > Error: file "thing.json" cannot be found or not in a path specified 
with -J
 > ```
 >
 > Is the actual inclusion of the file on import deferred until the link 
step?

I wonder whether it's an ldc thing related to its link-time powers?

 > I could insert the entire json into the file, but I would hate to do 
that.

I insert two many-megabytes long tar.gz files in there. :) I unzip and 
untar the files into a cache directory to use at runtime. I just works. 
The zipped version of a json file may be very small.

I my case, the files are gzip'ped during the build stage and I unzip with

   https://dlang.org/phobos/std_zlib.html

Ali



More information about the Digitalmars-d-learn mailing list