www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ImportC: Overriding standard search paths for C includes

reply kdevel <kdevel vogtner.de> writes:
Given the C source `cmysql.c` containing just

```C
#include <mysql/mysql.h>
```

Assume on a Linux system there is not only

```
/usr/include/mysql/mysql.h        (1)
```

but also

```
/tmp/dummyinclude/mysql/mysql.h   (2)
```

In order to instruct gcc to include the second file I compile with

```
gcc -I /tmp/dummyinclude cmysql.c
```

Now I have a D file test.d containing only

```D
import cmysql;
```

How do I get ImportC to include (2)? On my machine

```
dmd -I(=)/tmp/dummyinclude test.d
```

always `lstat`s and `open`s `/usr/include/mysql/mysql.h`?
Feb 27
parent reply kinke <noone nowhere.com> writes:
On Wednesday, 28 February 2024 at 07:13:35 UTC, kdevel wrote:
 ```
 dmd -I(=)/tmp/dummyinclude test.d
 ```
With `dmd -P=-I/tmp/dummyinclude test.d`.
Feb 28
parent kdevel <kdevel vogtner.de> writes:
On Wednesday, 28 February 2024 at 12:18:38 UTC, kinke wrote:
 On Wednesday, 28 February 2024 at 07:13:35 UTC, kdevel wrote:
 ```
 dmd -I(=)/tmp/dummyinclude test.d
 ```
With `dmd -P=-I/tmp/dummyinclude test.d`.
Thanks, works.
Mar 04