Thread overview
Want to write ldc2.conf
Aug 03, 2019
NonNull
Aug 03, 2019
NonNull
Aug 03, 2019
NonNull
Aug 03, 2019
NonNull
Aug 03, 2019
Boris Carvajal
Aug 05, 2019
Nemanja Boric
August 03, 2019
Where can I find how to add -Imydir and -Lmylib.lib to ldc2.conf to add to the existing configuration of ldc2?

August 03, 2019
On Saturday, 3 August 2019 at 20:22:52 UTC, NonNull wrote:
> Where can I find how to add -Imydir and -Lmylib.lib to ldc2.conf to add to the existing configuration of ldc2?

I looked here:

https://github.com/ldc-developers/ldc/blob/master/driver/config.d

because the comment in etc/ldc2.conf in the binary distribution of ldc2 I am using said to do that in a comment.

But this just gives me a grammar without any semantics.

I looked here:
https://wiki.dlang.org/Using_LDC
and it tells you where to put lcd2.conf if you write your own.

This seems to suggest that only one such file will be read, the first found in the search order. But it doesn't tell you how to write such a file.

I can edit a copy of the existing file and put it earlier in the search order. But that doesn't tell me what all the possibilities are.

Where is the documentation?

August 03, 2019
OK, I tried editing a copy of the config file that came with.

In accordance with https://wiki.dlang.org/Using_LDC I put it in my Windows home directory.

I added a post switch to add an include directory and one to add a lib directory.

According to https://wiki.dlang.org/Using_LDC having my ldc2.conf in my Windows home directory should be found before the default in etc/ alongside the directory that lcd2.exe is in.

Yet my ldc2.conf file is not being read: nothing different happens when I compile. It complains with a single location for import path when I have two such.

So it seems that https://wiki.dlang.org/Using_LDC is not correct.

Now what?

Please give me some working directions for where to put ldc2.conf NOT inside my ldc2 distribution.


August 03, 2019
On Saturday, 3 August 2019 at 21:58:11 UTC, NonNull wrote:
> OK, I tried editing a copy of the config file that came with.
>
> In accordance with https://wiki.dlang.org/Using_LDC I put it in my Windows home directory.

As this didn't work, I put it next to the executable I was compiling. Now it compiled immediately with no extra -I or -L on the command line. So my lcd2.conf is correct.

So I followed https://wiki.dlang.org/Using_LDC again. It says that ~/.ldc is also searched before etc/ next to bin directory containing ldc2 executable.

So I made a .ldc/ directory in my Windows home directory and put my ldc2.conf there.

Also did not work.

Tried renaming to .ldc2/ also did not work.

I have exhausted the possibilities according to https://wiki.dlang.org/Using_LDC that do not involve modifying the binary installation I am using.

What is the answer?


August 03, 2019
On Saturday, 3 August 2019 at 22:18:41 UTC, NonNull wrote:
> On Saturday, 3 August 2019 at 21:58:11 UTC, NonNull wrote:
> So I made a .ldc/ directory in my Windows home directory and put my ldc2.conf there.
>
> Also did not work.
>
> Tried renaming to .ldc2/ also did not work.
>
> I have exhausted the possibilities according to https://wiki.dlang.org/Using_LDC that do not involve modifying the binary installation I am using.
>
> What is the answer?

Try on %APPDATA% folder
August 05, 2019
On Saturday, 3 August 2019 at 22:58:03 UTC, Boris Carvajal wrote:
> On Saturday, 3 August 2019 at 22:18:41 UTC, NonNull wrote:
>> On Saturday, 3 August 2019 at 21:58:11 UTC, NonNull wrote:
>> So I made a .ldc/ directory in my Windows home directory and put my ldc2.conf there.
>>
>> Also did not work.
>>
>> Tried renaming to .ldc2/ also did not work.
>>
>> I have exhausted the possibilities according to https://wiki.dlang.org/Using_LDC that do not involve modifying the binary installation I am using.
>>
>> What is the answer?
>
> Try on %APPDATA% folder

Yes, that looks correct: https://github.com/ldc-developers/ldc/blob/984f30b8c4959173fe7d01bf8e1bcad116b7b36b/driver/configfile.cpp#L42-L49

    HRESULT res = SHGetFolderPathA(NULL, CSIDL_FLAG_CREATE | CSIDL_APPDATA, NULL,
                                   SHGFP_TYPE_CURRENT, buff);

The interesting bits about the load order can be found here: https://github.com/ldc-developers/ldc/blob/984f30b8c4959173fe7d01bf8e1bcad116b7b36b/driver/configfile.cpp#L94-L176