www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - SWIG?

reply "Scott Wilson" <scott_wilson_3rd yahoo.com> writes:
SWIG has D support. But it seems old and out of fashion. 
Community here does not buzz about it much either. Whats the word 
on the street about the quality of SWIG-D stuff?

Scott

PS thankyou Walter for replying
Aug 27 2014
next sibling parent "uri" <email ether.com> writes:
On Thursday, 28 August 2014 at 01:08:43 UTC, Scott Wilson wrote:
 SWIG has D support. But it seems old and out of fashion. 
 Community here does not buzz about it much either. Whats the 
 word on the street about the quality of SWIG-D stuff?

 Scott

 PS thankyou Walter for replying
The swig bindings are good and I use them quite a bit to interface with legacy C++ projects. This might be fixed already, I don't know and haven't tracked it but I had to make a minor change to the binding generator, as shown below. edit commoncore_im.d and change the following: --- mixin template SwigOperatorDefinitions() { ... static if (is(typeof(swigOpEquals(rhs)))) { return swigOpEquals(rhs); } else { ... --- to --- mixin template SwigOperatorDefinitions() { ... static if (is(typeof(swigOpEquals(rhs)))) { return cast(bool)(swigOpEquals(rhs)); // <-- cast(bool) added } else { ... --- cheers, uri
Aug 27 2014
prev sibling parent reply Timothee Cour via Digitalmars-d <digitalmars-d puremagic.com> writes:
I've used it quite a bit for a number of bindings (opencv, sfml + many
other libs). It's much easier than the conventional approach of manual
bindings (eg deimos), especially to keep the port up to date with upstream
changes.

However the following should be worked on:

* support for newly introduced C++ namespaces (
https://github.com/swig/swig/issues/213)

* some support for multiple inheritance (I proposed using alias this in
https://github.com/swig/swig/issues/98)

* mapping of C++ templates to D templates in simple cases at least (the
templates would have to be instantiated somewhere in source file of course
to avoid linker errors). Only the function signature would be mapped, the
implementation would be still on C++ side

* miscellaneous compiler warnings that shouldn't be hard to deal with
  - Deprecation: Read-modify-write operations are not allowed for shared
variables : has a pull request (https://github.com/swig/swig/issues/203 )
  - missing override

* it would help to have a dedicated bug tracker for D-swig. Currently
github issues for swig lump all other languages together, making D-swig of
limited visibility for D community. At least create a SWIG-D label in
github issues.

 klickverbot will tell you more as he implemented most of it IIRC



On Wed, Aug 27, 2014 at 6:08 PM, Scott Wilson via Digitalmars-d <
digitalmars-d puremagic.com> wrote:

 SWIG has D support. But it seems old and out of fashion. Community here
 does not buzz about it much either. Whats the word on the street about the
 quality of SWIG-D stuff?

 Scott

 PS thankyou Walter for replying
Aug 27 2014
parent "dlangophile" <dlangophile foo.bar> writes:
On Friday, 29 August 2014 at 02:10:48 UTC, Timothee Cour via 
Digitalmars-d wrote:
 I've used it quite a bit for a number of bindings (opencv, sfml 
  + many other libs).
Actually I would like to try some stuff with opencv, but I've never used SWIG, so I don't know how hight is the bar. To lower it, what do you think about some sort of github repo to push some SWIG bindings into? Something like 'opencv/2.4.9/stuffinside'? Bye, dlangophile
Aug 29 2014