Any interest in libgit bindings?

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Oct 11 07:34:29 PDT 2012


> Another thing I haven't been able to figure out yet is to how to properly translate
> include directives. It's not easy to translate to the module system used
> by D.

I don't have access to the include directives at all. The way I do it
is to have a "toNativeType" function which translates C/C++ types to D
and at the same time resolves includes. If a type is located in
another module (all non-fundamental types have a fileID field in XML)
then I insert that module's name to the currently generating module's
imports. Once all the module's symbols are generated I generate the
import directives.

> Right, I missed that. It's easy to forget this kind of symbols, they're
> not really keywords but they are kind of reserved words. Any other
> symbols behaving like this I could have missed?

Well if the library defines files which get converted to modules like
'std' you could easily conflict with Phobos. Some words I check are:
std core gc rt object Object string toString toHash mangleof. But
there's probably more, when something clashes I add it to the list.

You could easily get standard aliases (the ones from implicitly
imported object.d) hijacked, e.g. if there was a string typedef in a C
library:

alias const(char)* string;  // hijacks string alias from object.d


More information about the Digitalmars-d mailing list