A gentle critque..
Chad J
gamerChad at _spamIsBad_gmail.com
Mon May 15 01:05:22 PDT 2006
Anders F Björklund wrote:
> If you use a tool to help you, translating C headers is not THAT bad.
> Translating C++ headers is trickier, but can be done too if needed...
> I think that D has it slightly easier than some other languages, since
> it only needs to provide an import module - not any wrapper stubs, etc.
Is there a good tool for C plus plus to C to D translation?
> But it is still easier to link to C code in D, than what it is wih Java.
> You don't need to write or generate the JNI (or CNI) stubs, and so on...
Haha, so true.
> AFAIK, the support for linking against C libraries is a huge part of D.
> For instance, the Phobos std D library uses a lot of the std C library ?
> Not being able to link with "C" means *no* external functions at all...
> (those externals can be written in anything, if they export a "C" API)
>
> And for a language that supports inline assembler, it would be a bit
> strange to drop support for linking to "portable assembler" (aka. C) ?
I think I confused the term "linking" with... I don't even know what to
call it then. C plus plus integration maybe.
> Most of us translated the headers we needed, and got on with coding...
> Like someone said, 100% for all cases is hard - but it does like 90% ?
> There are several tools available, depending on what type that you like.
>
> It's a "known bug" with DMD, that such a tool isn't bundled by default.
> I did a perl hack that has worked OK (for me) for translating several
> large library headers from C to D, maybe I should bundle it with GDC ?
>
> --anders
I'd probably be pretty happy with 90-95% C plus plus header conversion.
I'd like to see that perl hack. Is it online somewhere?
I remember trying SWIG to get some C plus plus to D conversion going on,
but that setup didn't work very well. Required a lot of work just to
use it. Cure is worst than the disease sort of thing.
I noticed an h2d project on dsource. But I think that only worked on
linux, or something. For some reason I wasn't able to even try it.
I don't remember seeing any tools of this kind that were written in D.
Kind of unfortunate, probably makes it difficult to pool effort out of D
programmers for something that isn't written in D.
Any other tools I should look at?
More information about the Digitalmars-d
mailing list