From: Thomas J. <tho...@ut...> - 2008-03-20 01:16:36
|
William S Fulton wrote: > Thomas Jones wrote: >> I'm a 3rd year Computer Science student at University of Toronto, I'm >> interested in doing either a C target or a D target ( >> http://www.digitalmars.com/d/ ). >> >> I taught myself C/C++ in high school, but I haven't done much C++ >> since learning it, (I also learned a pre-standard version of it... >> However I have written lots of C and Java, so I do have some OOP >> experience, although I've written more C than Java. I have never >> used SWIG, so I'll need to learn it as I go, although I am interested >> in learning how to use it. >> > > Hi Thomas > > There is a D target language developed outside of SWIG, see > http://www.swig.org/compat.html#SupportedLanguages. It looks > abandoned, so there is scope to take what was achieved and merge it > into the latest version of SWIG. It will probably need updating to > compile and adding new features. You'd have to find out the status of > the project when it was abandoned to evaluate whether or not it is > worth using. I suggest liasing with the D community to see if there is > any more info on the module. I understand D is quite similar to Java. > If the JNI side is similar it might be quicker and easier to take the > Java module, which is very mature and stable, and port it to D. That > would be a great achievement. > > The C target it likely to be more challenging as there could be some > odd quirks mixing C and C++. It is certainly something that will be > interesting and a bit different to the other language modules. You > won't have to deal with the runtime system, so that makes it a lot > easier. The scripting languages use the runtime system - simply put, > it is a replacement for static type checking that a strongly typed > language like C++/Java does. I'd suggest looking at the C# or Java > module as a starting point and modifying those to generate C. > > Let us know your thoughts. > > William > Actually D can link directly with C code, all it needs is an extern(C) <prototype> in a D file, so binding C++ to D essentially consists of a C++ to C, then generate a bunch of prototypes in D, and wrapper classes so that it acts like the C++. D cannot link directly to C++, unlike C, since it has it's own name mangling and such, and C++'s type system is heinously complex and cannot map directly on to D's (C's can). |