On Saturday, 16 October 2021 at 06:39:46 UTC, rempas wrote:
```
// Filename: test.d
import test_c;

void main() {
  hello_world();
}

// Filename: test_og.c
#include <stdio.h>
#include <stdlib.h>

void hello_world() {
  puts("Hello world!!!");
}
```

After that, I'm using: `gcc -E -P test_og.c > test_c.c` to preprocess just like you shown and then I'm using the final command with DMD: `dmd test.d test_c.c` and I'm getting the following error message:

```
/usr/include/stdio.h(246): Error: found `__filename` when expecting `,`
```

These are __restrict errors again, but then I get a bunch of others as well. This test_og.c works (while obviously breaking some bswap functions):

```c
#define __restrict restrict
#define __asm__ asm
#define __extension__
#define __inline
#define __builtin_bswap16
#define __builtin_bswap32
#define __builtin_bswap64
#include <stdio.h>
#include <stdlib.h>

void hello_world() {
      puts("Hello world!!!");
}
```

It would be less annoying to compile the original test_og.o with gcc and then link it in.

Reply via email to