[Issue 22880] importC: __restrict restrict __restrict__

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 19 13:25:37 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22880

Andrea Fontana <trikkuz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from Andrea Fontana <trikkuz at gmail.com> ---
Hi Walter!

tl;dr: 
missing 
#define __asm__ asm  
#define __signed__

----

I did the same trick, using a file with a lot of define.

I was trying to compile some (single file) c libraries in c.

It almost works with your "importc.h" . 

For example mongoose https://github.com/cesanta/mongoose (8k+ stars on github)
is just a simple two-files library.

Using tinycc as preprocessor (tcc -E) I can actually embed it in a d project
(not only the .h but the whole library).
I use tcc since it generates simpler preprocessed files (with few extra
keyboards).

For this library the only missing define is __asm__ (also for gcc, clang)

This work:

cat test.c:

// NOT: #define __asm__
#define __asm__ asm
#include "importc.h"
#include "mongoose.c"

tcc -E test.c > mongoose.i 
dmd -c mongoose.i

With another similar project the problem is with __signed__ on a standard
header

--


More information about the Digitalmars-d-bugs mailing list