www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Announcing: D support in SWIG

reply klickverbot <see klickverbot.at> writes:
In a nutshell, SWIG is a »glue code« generator, allowing you to access 

Ruby, Python … and, since I merged my work into SWIG trunk a few days 
ago, also D, both version 1 and 2.

I have put up a short description of it at my blog 
(http://klickverbot.at/blog/2010/11/announcing-d-support-in-swig/), but 
to give it a whirl, just head over to the SWIG SVN and build it from 
there (http://swig.org/svn.html).

I would be glad if some brave souls could go ahead and test it in 
real-world use cases before it is officially released with SWIG for the 
first time (SWIG 2.0.2, date yet to be determined), so that any major 
bugs can be ironed out before.

If you have any questions or suggestions, feel free to post them here, 
drop me a line, or ask right away in #D at freenode. While I am quite 
busy at the moment, I'd be happy to help you with any issues 
(particularly happy if they concern the SWIG side of implementing 
enhancements, obviously, but also simple usage questions). Besides that, 
as always, it would be nice just to hear about what you are using this for.

Happy coding,
David
Nov 21 2010
next sibling parent BCS <anon anon.com> writes:
Hello klickverbot,

 In a nutshell, SWIG is a »glue code« generator, allowing you to access

 Ruby, Python . and, since I merged my work into SWIG trunk a few days
 ago, also D, both version 1 and 2.
 
I'm so tempted to go learn Go so I can write a program that's half D, half Go and some SWIG to tie the two together.
Nov 21 2010
prev sibling next sibling parent Fawzi Mohamed <fawzi gmx.ch> writes:
On 21-nov-10, at 18:27, klickverbot wrote:

 In a nutshell, SWIG is a =BBglue code=AB generator, allowing you to =20=

 Go, Java, Ruby, Python =85 and, since I merged my work into SWIG trunk =
=20
 a few days ago, also D, both version 1 and 2.

 I have put up a short description of it at my blog =
(http://klickverbot.at/blog/2010/11/announcing-d-support-in-swig/=20
 ), but to give it a whirl, just head over to the SWIG SVN and build =20=
 it from there (http://swig.org/svn.html).

 I would be glad if some brave souls could go ahead and test it in =20
 real-world use cases before it is officially released with SWIG for =20=
 the first time (SWIG 2.0.2, date yet to be determined), so that any =20=
 major bugs can be ironed out before.

 If you have any questions or suggestions, feel free to post them =20
 here, drop me a line, or ask right away in #D at freenode. While I =20
 am quite busy at the moment, I'd be happy to help you with any =20
 issues (particularly happy if they concern the SWIG side of =20
 implementing enhancements, obviously, but also simple usage =20
 questions). Besides that, as always, it would be nice just to hear =20
 about what you are using this for.

 Happy coding,
 David
nice work David, I was following your github repository, nice that you =20= made into the official repository. Fawzi
Nov 22 2010
prev sibling next sibling parent reply BLS <windevguy hotmail.de> writes:
Hi David,
let me shake your hands and say Thank You, GREAT work.

It was a bit difficult to build SWIG SVN on Windows. However. it was 
doable and as soon as I have some free time I will try make a few tests 
on a Win C++ GUI project.
Bjoern

On 21/11/2010 18:27, klickverbot wrote:
 In a nutshell, SWIG is a »glue code« generator, allowing you to access

 Ruby, Python … and, since I merged my work into SWIG trunk a few days
 ago, also D, both version 1 and 2.

 I have put up a short description of it at my blog
 (http://klickverbot.at/blog/2010/11/announcing-d-support-in-swig/), but
 to give it a whirl, just head over to the SWIG SVN and build it from
 there (http://swig.org/svn.html).

 I would be glad if some brave souls could go ahead and test it in
 real-world use cases before it is officially released with SWIG for the
 first time (SWIG 2.0.2, date yet to be determined), so that any major
 bugs can be ironed out before.

 If you have any questions or suggestions, feel free to post them here,
 drop me a line, or ask right away in #D at freenode. While I am quite
 busy at the moment, I'd be happy to help you with any issues
 (particularly happy if they concern the SWIG side of implementing
 enhancements, obviously, but also simple usage questions). Besides that,
 as always, it would be nice just to hear about what you are using this for.

 Happy coding,
 David
Nov 24 2010
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 11/24/10, BLS <windevguy hotmail.de> wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
Dec 08 2010
parent reply BLS <windevguy hotmail.de> writes:
On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 08 2010
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Okay, got it working now.

I've installed MinGW (again) via that new mingw-get installer from
sourceforge. And I had the same error message as you, so I've
downloaded pcre-8.01.tar.bz2 from
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, I've put it in
my swig svn directory (C:\MinGW\msys\1.0\src\swig) and I've ran the
tools/pcre-build.sh script.

So I've ran ./configure again and make. It's building right now.

On 12/8/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 08 2010
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Am I supossed to use
--with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe or just
--with-d2-compiler=C:\DMD\ path when calling configure?

On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Okay, got it working now.

 I've installed MinGW (again) via that new mingw-get installer from
 sourceforge. And I had the same error message as you, so I've
 downloaded pcre-8.01.tar.bz2 from
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, I've put it in
 my swig svn directory (C:\MinGW\msys\1.0\src\swig) and I've ran the
 tools/pcre-build.sh script.

 So I've ran ./configure again and make. It's building right now.

 On 12/8/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 08 2010
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Hey hey, good news, got it all working now.

I did a configure with:
--with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe and make to build
swig.

Then I've ran one example in:
C:\MinGW\msys\1.0\src\swig\Examples\d\class\ with: make D_VERSION=2 .
It builds and runs fine.

I've only tried one example, but great work klickverbot!!

On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Am I supossed to use
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe or just
 --with-d2-compiler=C:\DMD\ path when calling configure?

 On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Okay, got it working now.

 I've installed MinGW (again) via that new mingw-get installer from
 sourceforge. And I had the same error message as you, so I've
 downloaded pcre-8.01.tar.bz2 from
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, I've put it in
 my swig svn directory (C:\MinGW\msys\1.0\src\swig) and I've ran the
 tools/pcre-build.sh script.

 So I've ran ./configure again and make. It's building right now.

 On 12/8/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 08 2010
parent reply BLS <windevguy hotmail.de> writes:
On 08/12/2010 20:35, Andrej Mitrovic wrote:
 I did a configure with:
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe and make to build
 swig.
Guess you mean .. --with-d2-compiler=C:/DMD/dmd2/windows/bin/dmd.exe Bjoern
Dec 10 2010
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 12/10/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 20:35, Andrej Mitrovic wrote:
 I did a configure with:
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe and make to build
 swig.
Guess you mean .. --with-d2-compiler=C:/DMD/dmd2/windows/bin/dmd.exe Bjoern
Backslashes worked fine for me on MSYS: ... checking for R... no checking for 6g... no checking for 8g... no checking for gccgo... no checking for dmd... dmd ...
Dec 10 2010
prev sibling parent Jimmy Cao <jcao219 gmail.com> writes:
Take a look:
http://irrlichtd.codeplex.com/
<http://irrlichtd.codeplex.com/>

I think this is easy and fun to do, so I'll work on it in my spare time.
Dec 13 2010
prev sibling next sibling parent Jimmy Cao <jcao219 gmail.com> writes:
I've been trying to wrap Irrlicht with this (on Windows) lately.  Things are
working well.

On Wed, Dec 8, 2010 at 1:35 PM, Andrej Mitrovic
<andrej.mitrovich gmail.com>wrote:

 Hey hey, good news, got it all working now.

 I did a configure with:
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe and make to build
 swig.

 Then I've ran one example in:
 C:\MinGW\msys\1.0\src\swig\Examples\d\class\ with: make D_VERSION=2 .
 It builds and runs fine.

 I've only tried one example, but great work klickverbot!!

 On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Am I supossed to use
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe or just
 --with-d2-compiler=C:\DMD\ path when calling configure?

 On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Okay, got it working now.

 I've installed MinGW (again) via that new mingw-get installer from
 sourceforge. And I had the same error message as you, so I've
 downloaded pcre-8.01.tar.bz2 from
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, I've put it in
 my swig svn directory (C:\MinGW\msys\1.0\src\swig) and I've ran the
 tools/pcre-build.sh script.

 So I've ran ./configure again and make. It's building right now.

 On 12/8/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 08 2010
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I'm curious, can you use SWIG with D2 on Linux as well? From what I've
read so far in the docs, SWIG creates an extension module that can be
compiled as a dynamic library. But afaik there are some issues with
using dynamic libs in Linux with D2, at least that's what I've read a
few times in the newsgroups..

All of the examples work fine on windows, though. :)

On 12/8/10, Jimmy Cao <jcao219 gmail.com> wrote:
 I've been trying to wrap Irrlicht with this (on Windows) lately.  Things are
 working well.

 On Wed, Dec 8, 2010 at 1:35 PM, Andrej Mitrovic
 <andrej.mitrovich gmail.com>wrote:

 Hey hey, good news, got it all working now.

 I did a configure with:
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe and make to build
 swig.

 Then I've ran one example in:
 C:\MinGW\msys\1.0\src\swig\Examples\d\class\ with: make D_VERSION=2 .
 It builds and runs fine.

 I've only tried one example, but great work klickverbot!!

 On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Am I supossed to use
 --with-d2-compiler=C:\DMD\dmd2\windows\bin\dmd.exe or just
 --with-d2-compiler=C:\DMD\ path when calling configure?

 On 12/8/10, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Okay, got it working now.

 I've installed MinGW (again) via that new mingw-get installer from
 sourceforge. And I had the same error message as you, so I've
 downloaded pcre-8.01.tar.bz2 from
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, I've put it in
 my swig svn directory (C:\MinGW\msys\1.0\src\swig) and I've ran the
 tools/pcre-build.sh script.

 So I've ran ./configure again and make. It's building right now.

 On 12/8/10, BLS <windevguy hotmail.de> wrote:
 On 08/12/2010 18:48, Andrej Mitrovic wrote:
 On 11/24/10, BLS<windevguy hotmail.de>  wrote:
 Hi David,
 let me shake your hands and say Thank You, GREAT work.

 It was a bit difficult to build SWIG SVN on Windows.
Just finding those automake/autoconf/bison binaries is a detectives' work. How did u build from svn?
If I recall correctly, I've just installed MinGW, and MSYS calling svn, make,makeinstall. There was however a problem with pcre (I am using 8.10) I found the solution by reading the error message from make regarding pcre very careful. Sorry that all I can tell you atm. beside, to start msys via menu look for MinGW Shell hth bjoern
Dec 09 2010
parent reply klickverbot <see klickverbot.at> writes:
On 12/9/10 10:12 PM, Andrej Mitrovic wrote:
 I'm curious, can you use SWIG with D2 on Linux as well? From what I've
 read so far in the docs, SWIG creates an extension module that can be
 compiled as a dynamic library. But afaik there are some issues with
 using dynamic libs in Linux with D2, at least that's what I've read a
 few times in the newsgroups..
What's compiled as a dynamic library is the C/C++ wrapper layer, but the issues are related to writing dynamic libraries in D. By the way, the wrapper library could be linked statically as well (I'll implement that as soon as I have some time to spare), but due to the COFF/OMF issues on Windows, I decided to default to dynamic loading.
Dec 09 2010
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I'm thinking maybe we should have a SWIG interfaces project on
dsource, if one doesn't exist yet. If someone made SWIG interfaces for
some big library it would be cool to share it at one place so anyone
could download them.

On 12/9/10, klickverbot <see klickverbot.at> wrote:
 On 12/9/10 10:12 PM, Andrej Mitrovic wrote:
 I'm curious, can you use SWIG with D2 on Linux as well? From what I've
 read so far in the docs, SWIG creates an extension module that can be
 compiled as a dynamic library. But afaik there are some issues with
 using dynamic libs in Linux with D2, at least that's what I've read a
 few times in the newsgroups..
What's compiled as a dynamic library is the C/C++ wrapper layer, but the issues are related to writing dynamic libraries in D. By the way, the wrapper library could be linked statically as well (I'll implement that as soon as I have some time to spare), but due to the COFF/OMF issues on Windows, I decided to default to dynamic loading.
Dec 09 2010
parent reply BLS <windevguy hotmail.de> writes:
On 09/12/2010 23:47, Andrej Mitrovic wrote:
 I'm thinking maybe we should have a SWIG interfaces project on
 dsource, if one doesn't exist yet. If someone made SWIG interfaces for
 some big library it would be cool to share it at one place so anyone
 could download them.
Vote++ A discussion Forum would be nice too. I am just trying to figure out what to do with : operator HWND() const;
Dec 09 2010
next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I just had a 30-minute look at the documentation. There's a whole
section on interfacing with C++, so maybe you can find some help
there.

It looks pretty trivial to wrap C code (in most cases we don't even
need SWIG for C), but C++ is a different beast. Thanks for writing
that D-specific documentation, klickverbot!

On 12/10/10, BLS <windevguy hotmail.de> wrote:
 On 09/12/2010 23:47, Andrej Mitrovic wrote:
 I'm thinking maybe we should have a SWIG interfaces project on
 dsource, if one doesn't exist yet. If someone made SWIG interfaces for
 some big library it would be cool to share it at one place so anyone
 could download them.
Vote++ A discussion Forum would be nice too. I am just trying to figure out what to do with : operator HWND() const;
Dec 09 2010
parent klickverbot <see klickverbot.at> writes:
On 12/10/10 12:49 AM, Andrej Mitrovic wrote:
 […]  Thanks for writing
 that D-specific documentation, klickverbot!
Well, as for most small-scale OSS projects, writing good docs is pretty boring when you can hack right away on some code as well, so I could really need some suggestions on the D specific parts. For instance, the D chapter desperately needs some small examples that demonstrate how all the customization features of SWIG play together to wrap the most common types of C/C++ APIs, e.g. converting return values to exceptions via custom dptype/dout typemap, renaming cast operators, injecting additional code into the generated D layer to construct more abstract proxy objects of some sorts, etc…
Dec 09 2010
prev sibling parent reply klickverbot <see klickverbot.at> writes:
On 12/10/10 12:12 AM, BLS wrote:
 Vote++ A discussion Forum would be nice too.
 I am just trying to figure out what to do with :

 operator HWND() const;
Any suggestions on that? The previous attempt for D support in SWIG (which became unmaintained at a rather early stage and didn't make its way into the SWIG core distribution) had a project at DSource [1], but although I really appreciate all the effort that went into it and the great service it has been providing for a really long time now, I am not sure if DSource is the way to go for this kind of effort. For example, DSource seems to be surrounded by a cloud of bad karma lately – lots of dead or obsolete projects, very busy admin(s), server outages, etc. Also, a possible DSource project wouldn't really have a common source code base, at least I wouldn't want to maintain a collection of SWIG interface files for specific libraries I probably don't even use myself. Another thing is that since D support is an official part of SWIG now, there are also the official communication channels (SF.net tracker, the swig-user ML, etc.). These questions make me wonder if it would be a better idea to use separate repositories for each library binding, probably at some DVCS site where projects are easily forkable (like GitHub, Bitbucket and the likes), and keep a central page/thread somewhere with links to the individual projects. Discussing SWIG and D is an entirely different topic, for which there are many possible options: a newly created digitalmars.D.bindings NG, a forum hosted somewhere (DSource, …), Stackoverflow (tagged »swig« and »d« or maybe even »swig-d«), the Swig-user mailing list, and probably a few more I didn't think of right now. Regarding your specific problem: Generally speaking, operator overloading is WIP (hopefully I find time to implement it for D2 during the weekend), but implicit conversions can't really be mapped to D anyway, so just use the %rename directive of SWIG to map the implicit conversion operator to a regular member function like »asHwnd()«. [1] http://dsource.org/projects/swig4d
Dec 09 2010
next sibling parent BLS <windevguy hotmail.de> writes:
On 10/12/2010 01:27, klickverbot wrote:
 Regarding your specific problem: Generally speaking, operator
 overloading is WIP (hopefully I find time to implement it for D2 during
 the weekend), but implicit conversions can't really be mapped to D
 anyway, so just use the %rename directive of SWIG to map the implicit
 conversion operator to a regular member function like »asHwnd()«.
Whatever it is, or will be, I don't care. It is just that IMHO we need a discussion platform. I think it is not an egoistic point of view to ask for support. I guess serious questions will make SWIG 4 D more reliable. Just a suggestion : why not use the D WIKI for FAQ, Documentation links and HOW TO s. I would further like to suggest that we! add a real world windows_sample.i plus windows_sample.h file in order to explain how to deal with HWND, LPCTSTR, DWORD respective CWnd* GetCWndFromMap(HWND hWnd); etc.. will send you a short(promised) email David Once again, thanks for such a nice piece of work. Bjoern
Dec 09 2010
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Yeah, maybe dsource wasn't such a good idea. It does have a lot of
dead projects and nobody wants to put up categories to split up D1/D2
projects (and the forums are sloooow).

Maybe a better solution is to just add any new interfaces to a D Wiki
page   http://www.prowiki.org/wiki4d/wiki.cgi

On 12/10/10, BLS <windevguy hotmail.de> wrote:
 On 10/12/2010 01:27, klickverbot wrote:
 Discussing SWIG and D is an entirely different topic, for which there
 are many possible options: a newly created digitalmars.D.bindings NG, a
 forum hosted somewhere (DSource, =85), Stackoverflow (tagged =BBswig=AB =
and
 =BBd=AB or maybe even =BBswig-d=AB), the Swig-user mailing list, and pro=
bably a
 few more I didn't think of right now.
Whatever it is, or will be, I don't care. It is just that IMHO we need a discussion platform. I think it is not only an egoistic point view to ask for support. I guess serious questions will make SWIG 4 D more reliable. Just a suggestion : why not use the D WIKI for FAQ, Documentation links and HOW TOs. Probably we could also to publish the SWIG 4 D documentation=
.
 I would further like to suggest that we! add a real world
 windows_sample.i plus windows_sample.h file in order to explain how to
 deal with HWND, LPCTSTR, DWORD  respective
 CWnd* GetCWndFromMap(HWND hWnd); etc..

 will send you a short(promised) email David
 Once again, thanks for such a nice piece of work.
 Bjoern
Dec 09 2010
prev sibling next sibling parent Jimmy Cao <jcao219 gmail.com> writes:
On Thu, Dec 9, 2010 at 8:49 PM, BLS <windevguy hotmail.de> wrote:
 Whatever it is, or will be, I don't care. It is just that IMHO we need a
 discussion platform.
Definitely also IRC. The usual #d for now, then maybe #d.swig if there is more interest? (FreeNode)
Dec 09 2010
prev sibling parent BLS <windevguy hotmail.de> writes:
On 10/12/2010 01:27, klickverbot wrote:
 Regarding your specific problem: Generally speaking, operator
 overloading is WIP (hopefully I find time to implement it for D2 during
 the weekend), but implicit conversions can't really be mapped to D
 anyway, so just use the %rename directive of SWIG to map the implicit
 conversion operator to a regular member function like »asHwnd()«.
Using the %rename directive sound reasonable... I'll give it a try. thanks, bjoern
Dec 09 2010
prev sibling next sibling parent reply klickverbot <see klickverbot.at> writes:
Sorry if this might come a bit late for anybody following SWIG SVN 
trunk, but I needed to make a breaking naming change to the D module of 


The details, along with a sed script for fixing any custom typemaps: 
ttp://klickverbot.at/blog/2010/12/swig-d-breaking-name-changes/

This should have been the last major breaking change, at least I hope so.

David
Dec 02 2010
parent klickverbot <see klickverbot.at> writes:
On 12/2/10 6:00 PM, klickverbot wrote:
 The details, along with a sed script for fixing any custom typemaps:
 ttp://klickverbot.at/blog/2010/12/swig-d-breaking-name-changes/
Oops, there is an h missing, that should have obviously been http://klickverbot.at/blog/2010/12/swig-d-breaking-name-changes/.
Dec 02 2010
prev sibling next sibling parent reply Jordi <jordi rovira.cat> writes:
Hi,

   I just wanted to drop a note to say that i have tried it and it works 
quite well. I am wrapping a small C++ library and using in my D application.

   Thanks!

j.

On 11/21/2010 06:27 PM, klickverbot wrote:
 In a nutshell, SWIG is a »glue code« generator, allowing you to access

 Ruby, Python … and, since I merged my work into SWIG trunk a few days
 ago, also D, both version 1 and 2.

 I have put up a short description of it at my blog
 (http://klickverbot.at/blog/2010/11/announcing-d-support-in-swig/), but
 to give it a whirl, just head over to the SWIG SVN and build it from
 there (http://swig.org/svn.html).

 I would be glad if some brave souls could go ahead and test it in
 real-world use cases before it is officially released with SWIG for the
 first time (SWIG 2.0.2, date yet to be determined), so that any major
 bugs can be ironed out before.

 If you have any questions or suggestions, feel free to post them here,
 drop me a line, or ask right away in #D at freenode. While I am quite
 busy at the moment, I'd be happy to help you with any issues
 (particularly happy if they concern the SWIG side of implementing
 enhancements, obviously, but also simple usage questions). Besides that,
 as always, it would be nice just to hear about what you are using this for.

 Happy coding,
 David
Jan 19 2011
parent reply Trass3r <un known.com> writes:
    I just wanted to drop a note to say that i have tried it and it works  
 quite well. I am wrapping a small C++ library and using in my D  
 application.
Is there a tutorial (not 50 pages of text) about what needs to be done to support a C++ library?
Jan 19 2011
parent Jordi <jordi rovira.cat> writes:
On 01/19/2011 07:16 PM, Trass3r wrote:
 I just wanted to drop a note to say that i have tried it and it works
 quite well. I am wrapping a small C++ library and using in my D
 application.
Is there a tutorial (not 50 pages of text) about what needs to be done to support a C++ library?
I don't know. As i am making the C++ library myself too, i was very careful to follow stric guidelines to make it easy to wrap. Most of it is explained in the big Swig manual, but i pressume that that is what you mean with 50+ pages :).
Jan 19 2011
prev sibling parent reply Trass3r <un known.com> writes:
Does SWIG also support turning all those crappy C++ Get*/Set* methods you can
find in almost every OOP-based project into proper D properties (incl. removing
Get/Set and turning the next letter lowercase)?
Feb 02 2011
parent David Nadlinger <see klickverbot.at> writes:
On 2/2/11 2:02 PM, Trass3r wrote:
 Does SWIG also support turning all those crappy C++ Get*/Set* methods you can
find in almost every OOP-based project into proper D properties (incl. removing
Get/Set and turning the next letter lowercase)?
There is regex-based rename support in SWIG, so this should certainly be doable – I haven't personally tried it yet, though. David
Feb 02 2011