More automated interfacing of D with C codebases
Brad Lanam
brad.lanam.comp at -NOSPAM-gmail.com
Sun Oct 21 13:21:27 PDT 2012
On Sunday, 21 October 2012 at 19:45:53 UTC, timotheecour wrote:
> I've had good experience using SWIG to automate the job for me,
> and used it successfully to port the following libraries to D:
Yes. SWIG should be a lot faster than my tool.
Also I don't have any units to handle C++ code.
Completely agree. It has to be automated.
> Swig isn't perfect however, and sometimes will bail out on
> constructs such as:
> C++ classes with multiple inheritance, or a few obscure C or C++
> constructs. Even in that case, I find it much easier to tweak
If I recall, I ran into some obscure C constructs in the Tcl/Tk/X
headers that I have never seen before. I believe I had to
various aliases to my "interface file" to handle those. Also use
of D reserved words had to be handled:
substitute new new_
substitute class class_
substitute 'function;' 'function_;'
And some things just plain won't work in D:
# not valid D code.
substitute '_XPrivate .private9, .private10;' \
'_XPrivate * private9, private10;'
More information about the Digitalmars-d-learn
mailing list