Wrapping C code?

CJS Prometheus85 at hotmail.com
Sat Mar 29 14:30:02 PDT 2014


>
> Well, you can write one. You can also let D generate that list:
> __traits(allMembers, some_c_module) gives you all symbols in
> some_c_module.
>
> Iterate over them, generate alias declarations, mix those
> declarations in.

I don't understand how that is possible. The C code I have 
available is a compiled library and its headers, so libfoo.a (or 
libfoo.so) and foo.h. I've compiled D calling C before by 
declaring the C function inside D code and then linking libfoo.a 
to the compiled D code.

Can you provide a short example of how this would work?


More information about the Digitalmars-d-learn mailing list