how to make pragma(lib)'s path relative to the package's path?
ryuukk_
ryuukk.dev at gmail.com
Sun Jul 30 18:40:58 UTC 2023
example:
I have 2 projects:
- ``lib_a/``: depends on ``bin/lib.a`` static library
- ``app/``: imports ``lib_a``
Folder structure:
```
..
├── app
│ ├── main.d
│ └── main.o
└── libs
└── lib_a
├── bin
│ └── lib.a
└── package.d
```
``lib_a``'s prama(lib) path for the ``lib.a`` file looks like
this: ``pragma(lib, "bin/lib.a");``
If i compile my ``app/``, it complains:
``
ryuukk at ark:~/dev/dbug/app
$ dmd -i -I../libs/ -run main.d
/usr/bin/ld: cannot find bin/lib.a: No such file or directory
``
If i change the pragma path to: ``pragma(lib,
"../libs/lib_a/bin/lib.a");``
Then it works..
So the problem is DMD searchs for the library with the path
related to the path of ``app/``, instead of ``lib_a``
Question: how to i make it so DMD search for ``lib.a`` relative
to ``lib_a/`` project?
An anotated screenshot to better view the problem:

More information about the Digitalmars-d-learn
mailing list