C++ Binding Generator

ed growlercab at gmail.com
Mon Feb 17 22:44:18 PST 2014


On Monday, 17 February 2014 at 08:49:09 UTC, Abdulhaq wrote:
>
>> I have a SWIG version of D-VTK but it is a little flaky and 
>> soooo slow to generate. I've just started work developing D 
>> wrapper for VTK based on their Java wrapper but it's very 
>> early stages (started yesterday in fact).
>>
>> If you've got a VTK wrapping that generates D code I'd love to 
>> check it out.
>>
>
> The smidgen binding generator is (I believe) sufficiently 
> feature rich to wrap all of VTK, but I've only wrapped a half 
> dozen classes as proof of concept for now (I've been focussing 
> on Qt5). My plan on the VTK side has been to use the automated 
> binding generator in VTK to produce the *.sip (similar to *.h) 
> files that smidgen needs.
>
> VTK is quite a large library so I would expect the wrapper to 
> be a bit slow to generate, however it shouldn't be flaky when 
> running. I would suspect that you've got a glitch in object 
> ownership somewhere? My plan has been that the automatic VTK 
> binding generator for e.g. python knows about object ownership, 
> and so I can tap in to that to generate the correct smidgen 
> annotations that are needed for that aspect of the binding. 
> I've also found that you can get problems when wrapped methods 
> return instances typed as base classes that need casting to 
> more specific types.
>
> I'm wondering if we can pool our efforts somehow? Because I 
> need to finish the last parts of smidgen (e.g. enums with 
> specific values and subtleties with C++ multiple 
> inheritance)and the Qt5 wrapping side of it I couldn't divert 
> much from my current trajectory, but if you get a chance then 
> have a look at what smidgen is doing and see if you think you'd 
> get any benefit using it (and you'd have my efforts working to 
> extend smidgen for you if needed). As soon as I've uploaded the 
> current smidgen-vtk I'll notify here.
>
> Another way we might be able to cooperate is getting a full 
> understanding of the current built-in VTK binding generator 
> technology.
>
> Is your SWIG wrapping online somewhere? - I'd like to take a 
> look.

https://github.com/lyrebirdsw/vtkdbind

The SWIG bindings were left in a very bad state so they won't 
work at the moment. It should generate the D code and possibly 
compile but I don't think it will link I sort of gave up on it 
and decided to try the VTK wrapper generator.

The last bindings I generated are in the repo under 
swigd/bindings/d

Oh and some of the scripts will have a copyright in them, ignore 
it. It is just the automatic header our editors at work stamp in. 
It is all opensource, consider it BSD, I just haven't bothered 
putting any license in the files themselves.

As for the VTK wrapper bindings they are convoluted but I'm 
making some headway. It is spread across C++/CMake files to 
complete the full process. The C++ creates a parser which 
extracts the required details, CMake then feeds the output of 
this into the wrapper generator.

I have it generating half D / half Java at the moment. If I get 
it all D and compiling I'll upload it.

Cheers,
ed



More information about the Digitalmars-d mailing list