problems with swig generated code

Laeeth Isharc laeeth at
Tue Sep 3 23:14:01 UTC 2019

On Tuesday, 3 September 2019 at 20:03:37 UTC, Martin DeMello 
> On Sunday, 1 September 2019 at 11:19:11 UTC, DanielG wrote:
>> Do you know whether SWIG's D generator is even being 
>> maintained?
>> I've searched for it on the forums in the past and got the 
>> impression that it's outdated.
> I didn't realise that :( It was included in the current release 
> of swig, so I figured it was maintained.
> It's pretty sad if it's not, because trying to access C++ 
> libraries directly from D has some limitations (most notably 
> not being able to create new C++ objects from D) and swig would 
> have let things just work.

I think DPP can call constructors. YMMV.

We are working on a little project I started as another step in 
the eternal personal hackathon.

Libclang isn't my cup of tea.  It's almost very cool but they put 
in whatever the guy needed and so it's inconsistent but your 
alternative is code that breaks things between breakfast and 

Cling is used at CERN and I found libcling more pleasant.  I only 
wrapped the cppyy fork but that actually allows you to reflect at 
runtime on a lot.  From our DSL at work I can include a header, 
instantiate a templated type, create an instance of the class and 
call a method on it.  Can, but it's not what I would call fun.

I didn't yet get time to wrap the rest of the interpreter.

But the idea is to make a tool for wrapping c++ via simpler 
extern (C++).  If one isn't quite sure upfront what will work and 
not then it's much more pragmatic.  I can't see how it won't work 
but we will know in a week or two.

My first version is here.

There is another route people don't think of.  Calypso can 
introspect on C++ too.  You might not want to use it in 
production but you don't need to.  Either I guess you could use 
it to generate wrappers or you can use it to replace a chunk of 
cpp code.

The surface area of a method must be larger than thr surface area 
of a chunk.  Well chosen then it's easy to write glue code semi 
automatically.  But it's nice to be able to replace a method at a 
time and have working code at every step.

You don't need to trust Calypso in production to be able to use 
it for this purpose.

More information about the Digitalmars-d-learn mailing list