Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 18, 2003 SWIG for D | ||||
---|---|---|---|---|
| ||||
I am reposting Benji's message in a new thread: --------------------------------------------------------------- Holy cow. I just downloaded the SWIG sources and I've been looking around at what it would take to write a SWIG extension for D. And this is the answer: NOT VERY MUCH In order to customize SWIG for any given language, there is only one source file that needs to be created. For Java, it's a file called "java.cxx" for C#, it's a file called "csharp.cxx". Each of these files is moderately complex. The java file, with all of the comments and newlines stripped out, is about 1400 lines of code (in C++). The csharp file is about 1600 lines. That's not very much code. Plus, I'm guessing that much of the code for the D extension would look an awful lot like the code for the Java and C# extensions, so we could borrow heavily from the existing implementation. However, this project is not for the faint of heart. Even if it only requires writing 1500 or so lines of code, the author will have to have a pretty good command of C++ (I'm already out of the running) and an excellent understanding of D semantics (that eliminately most of us). But, on the upside, once it's done we'll have access to millions of lines of C++ code to use as imports and libraries for our own projects. I'm just giddy at the notion that we could suddenly have access to the entire wxWindows library, after writing only 1500 lines of code. --Benji Smith |
September 20, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Who is takening this SWIG project? This is too exciting to let it fade out. I'm on the same category as Benji (not enough C++), But here we differ is that that want stop me from give it a try (and maybe more free time...). I'm still working for DUI and DPQ because I can see the first beta version for them (this weekend, next?) and I'm getting a bit tired to have 3 projects going. If you see an announcement for those betas and nobody else declared to taking on SWIG you can consired that I have. D will have two big names: - Walter for creating it - <someone> for opening it to the world with SWIG If SWIG really works for us is there any reason at all for keep using C/C++!? (ok, ok not serious) Soon all other languages will be "D"eprecated... (see previous note) SWIG was referenced on the NG back in march (before I was a regular here). I'm copying the conversation. Ant ############################################ Subject: SWIG can provide C++ class wrapping and header import. From: Ilya Minkov <midiclub@8ung.at> Newsgroups: D Date: Fri, 07 Mar 2003 00:50:04 +0100 http://www.swig.org/exec.html Is probably worth taking a look. This utility has been developed to allow to use native-compiled libraries written in C and C++ from scripting languages. It has a powerful parser which deals with any imaginable problem, and currently has export modules not only for scripting languages such as Python, Perl, and others, but also to statically typed languages such as Java and OCaml. I can see 2 uses for it - first, to generate D import units, including the code to wrap C++ classes into D classes (dunno whether it actually works), and OTOH to allow scripting languages to use D libraries. It has more than 7 years of development in it - and a lot of thought. Definately more than i could spend for a similar project. :) It handles all the things which are not at all trivial. Overwhelming. -i. Subject: Re: SWIG can provide C++ class wrapping and header import. From: Bill Cox <Bill_member@pathlink.com> Newsgroups: D Date: Fri, 7 Mar 2003 03:21:41 +0000 (UTC) We use it for our TCL scripting. I'm currently stuck on a problem, though. I haven't been able to figure out how to pass variable parameters to my routines so I can deal with options. We may have to drop it, if it get's in the way of parameter parsing, but for the most part, it's been very useful. I'm sure a D version will be available soon enough. They seem to add support for just about everything. Bill Subject: Re: SWIG can provide C++ class wrapping and header import. From: Mark Evans <Mark_member@pathlink.com> Newsgroups: D Date: Fri, 7 Mar 2003 01:41:14 +0000 (UTC) SWIG is a fantastic tool and well-known in the scripting world, e.g. for interfacing C++ GUI libraries to alien tongues. It even supports O'Caml! Only in the case of Python would I recommend an alternative, the Boost Python Library, and then only because BPL is custom-made for Python. SWIG support for D is a good idea. Still...I wonder a bit. D is already so close to C/C++ that interfacing should be built directly into the language. To an extent it is; D can invoke C code directly. Yet it cannot invoke C++ code, that is the lack. Walter might be able to cook up something in the special case when the C++ code is compiled by DMC++. What intrigues me here is the concept of porting C++ code to D. That seamless capability would make porting C++ to D much easier, and would be a good selling point to people with an interest in D but much legacy C++ code on their hands. Mark |
September 20, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> Who is takening this SWIG project?
> This is too exciting to let it fade out.
hm. Benji Smith wasn't kidding. This really *is* easy. I have a module thing that creates bindings for a (blessedly) mythical hybrid C#/D monstrosity already.
Either I'll (likely) have this done before the weekend is through, or someone will beat me to it. Either way is fine by me. ;)
-- andy
|
September 20, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | In article <bkgr9b$bkl$1@digitaldaemon.com>, Andy Friesen says... >hm. Benji Smith wasn't kidding. This really *is* easy. I have a module thing that creates bindings for a (blessedly) mythical hybrid C#/D monstrosity already. > >Either I'll (likely) have this done before the weekend is through, or someone will beat me to it. Either way is fine by me. ;) That's awesome. I hope you get something working that we can all use within a pretty short period of time. I assume that you're working with the code from the 1.3.19 release (available on their download site). And that's a good thing, because it's an official release, and it actually compiles. However, from what I've been told (by the guy who wrote the C# and Java language modules), there have been lots of changes made to the core sources and the language modules since then. Following his advice, I checked the most recent sources out of CVS, but I couldn't get them to compile on my machine. So we should stay away from the CVS sources until they hit their next release (in a month or two). However, there may be some work involved in updating the D module when the next swig release is finished. Are you willing to be the SWIG guy? Are you willing to field bug reports and maintenance for the D swig module for the next six months or so? If so, when the repository site is ready, I'll make you the project owner for the D swig project. And, if Andy isn't able to take on that responsibility, is there someone else who can? --Benji Smith |
September 21, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benji Smith | Benji Smith wrote: > That's awesome. I hope you get something working that we can all use within a > pretty short period of time. You bet. http://ikagames.com/andy/d/swig-with-d.tar.bz2 Precompiled win32 binary included. Unix people are encouraged to do the configure && make dance. It's pretty nasty, and not tested very well, but my head is about to implode from the sheer effort required just to get the stupid thing to compile with the addition of dmd.cxx (remember kids, friends don't let friends use .cxx for C++ source) > I assume that you're working with the code from the > 1.3.19 release (available on their download site). And that's a good thing, > because it's an official release, and it actually compiles. However, from what > I've been told (by the guy who wrote the C# and Java language modules), there > have been lots of changes made to the core sources and the language modules > since then. Following his advice, I checked the most recent sources out of CVS, > but I couldn't get them to compile on my machine. So we should stay away from > the CVS sources until they hit their next release (in a month or two). > However, there may be some work involved in updating the D module when the next > swig release is finished. Are you willing to be the SWIG guy? Are you willing to > field bug reports and maintenance for the D swig module for the next six months > or so? Sounds good to me. |
September 21, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | In article <bkj34t$gte$1@digitaldaemon.com>, Andy Friesen says... > >You bet. http://ikagames.com/andy/d/swig-with-d.tar.bz2 I guess you mean http://ikagames.com/andy/d/swig-with-dmd.tar.bz2 > >Precompiled win32 binary included. Unix people are encouraged to do the configure && make dance. make fails. quick changes just to make it run: 1 - get Andy's SWID for D 2 - remove the .deps directories in Source/* 3 - add dmd to the lib-languages variable in Makefile.in line 298/299 thanks Andy. Ant |
September 21, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
>
> I guess you mean
>
> http://ikagames.com/andy/d/swig-with-dmd.tar.bz2
>
> make fails. quick changes just to make it run:
>
> 1 - get Andy's SWID for D
> 2 - remove the .deps directories in Source/*
> 3 - add dmd to the lib-languages variable in Makefile.in line 298/299
Fixed. (I hope)
Thanks!
-- andy
|
September 21, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | In article <bkjbqh$1fjt$1@digitaldaemon.com>, Andy Friesen says... > >Ant wrote: >> >> I guess you mean >> >> http://ikagames.com/andy/d/swig-with-dmd.tar.bz2 >> >> make fails. quick changes just to make it run: >> >> 1 - get Andy's SWID for D >> 2 - remove the .deps directories in Source/* >> 3 - add dmd to the lib-languages variable in Makefile.in line 298/299 > >Fixed. (I hope) Sorry, my fault, by "directories" instead of "directory" I meant all ".deps" in the Source tree: Source |-- Source/CParse | `-- Source/CParse/.deps |-- Source/DOH | `-- Source/DOH/.deps |-- Source/Include |-- Source/Modules | `-- Source/Modules/.deps |-- Source/Preprocessor | `-- Source/Preprocessor/.deps `-- Source/Swig `-- Source/Swig/.deps (testing now ... configure ... yep, that does it, make is running.) Ant |
September 22, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benji Smith | "Benji Smith" <dlanguage@xxagg.com> wrote in message news:bkigq7$2pvo$1@digitaldaemon.com... > That's awesome. I hope you get something working that we can all use within a > pretty short period of time. I assume that you're working with the code from the > 1.3.19 release (available on their download site). And that's a good thing, > because it's an official release, and it actually compiles. However, from what > I've been told (by the guy who wrote the C# and Java language modules), there > have been lots of changes made to the core sources and the language modules > since then. Following his advice, I checked the most recent sources out of CVS, > but I couldn't get them to compile on my machine. So we should stay away from > the CVS sources until they hit their next release (in a month or two). > > However, there may be some work involved in updating the D module when the next > swig release is finished. Are you willing to be the SWIG guy? Are you willing to > field bug reports and maintenance for the D swig module for the next six months > or so? If so, when the repository site is ready, I'll make you the project owner > for the D swig project. > > And, if Andy isn't able to take on that responsibility, is there someone else > who can? Even if the D personality module for SWIG only works with the 1.3.19 release, that's good enough. It'll solve our problem for the foreseeable future. Don't need to swing for a home run just yet! |
September 22, 2003 Re: SWIG for D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> Sorry, my fault, by "directories" instead of "directory" I meant
> all ".deps" in the Source tree:
>
> (testing now ... configure ... yep, that does it, make is running.)
>
> Ant
>
Alright, fixed.
-- andy
|
Copyright © 1999-2021 by the D Language Foundation