Discussion:
[Swig-devel] C++ to C++
Nikita Simonian
2016-11-15 18:46:01 UTC
Permalink
Greetings,

I've searched around the archive a bit, and found a few emails about using
SWIG to wrap C++ back into C++ for the purpose of allowing to mix different
runtimes.

If I understand it correctly there's currently no module that allows to do
this. With C++ 11 it seems that most of the architecture that went into the
design of the C++ to C# (such as e.g. using *thread_local* ) for exceptions
handling can be recycled.

I have a few practical questions to the SWIG developers. How hard would you
guys think is to undertake such a project? E.g. in your experience how long
do you think it would take for a savvy engineer, somewhat familiar with
SWIG (on a user level) to roll a such new module in some usable form, and
what are the most obvious difficulties?

Thanks, Nikita
William S Fulton
2016-11-25 19:38:46 UTC
Permalink
Hi Nikita

Correct, there is no module to do this. The idea is to build it on top
of the C module, but the C module is not in a fit state yet due to
lack of someone wanting to put the work in to finish it. Hard to say
how long it'll take, maybe a couple of months to get the C layer then
a C++ layer working to a fairly good standard. The standard to get it
accepted into master is very high though... the entire test-suite must
pass with plenty of runtime tests and documentation. I think it should
only be tackled by someone familiar with SWIG (as a user or developer)
in order to get it right. The challenges are getting familiar with the
SWIG code base, but it isn't that hard. Given all C++ language
features work for the other target languages and most of these go
through a C layer, it shouldn't be too hard to get it all working.
Some hand-written test cases would be advised to handle the main
features. If hand-written test cases work, it is then just grunge work
and getting the code generated correctly. One thing that SWIG pretty
much ignores is const ... there is no equivalent in the current set of
target languages. This might be an area that will need attention in
the SWIG core in order to carry the const through into the C or C++
layer. There wouldn't be any templates in the generated code as
templates are 'instantiated' with a non-template name using %template.
Deviating from this SWIG norm may not be a good idea or easy to
implement.

Please let us know if you will be working on this and if so fantastic
and good luck!

I think the latest C layer branch is at
https://github.com/swig/swig/tree/gsoc2012-c, but if you search the
mailing lists, I've a vague recollection of some additional work being
done on top of this branch, but may be wrong.

William
Post by Nikita Simonian
Greetings,
I've searched around the archive a bit, and found a few emails about using
SWIG to wrap C++ back into C++ for the purpose of allowing to mix different
runtimes.
If I understand it correctly there's currently no module that allows to do
this. With C++ 11 it seems that most of the architecture that went into the
design of the C++ to C# (such as e.g. using thread_local ) for exceptions
handling can be recycled.
I have a few practical questions to the SWIG developers. How hard would you
guys think is to undertake such a project? E.g. in your experience how long
do you think it would take for a savvy engineer, somewhat familiar with SWIG
(on a user level) to roll a such new module in some usable form, and what
are the most obvious difficulties?
Thanks, Nikita
------------------------------------------------------------------------------
_______________________________________________
Swig-devel mailing list
https://lists.sourceforge.net/lists/listinfo/swig-devel
------------------------------------------------------------------------------
Vadim Zeitlin
2016-11-25 20:24:33 UTC
Permalink
On Fri, 25 Nov 2016 19:38:46 +0000 William S Fulton <***@fultondesigns.co.uk> wrote:

WSF> I think the latest C layer branch is at
WSF> https://github.com/swig/swig/tree/gsoc2012-c, but if you search the
WSF> mailing lists, I've a vague recollection of some additional work being
WSF> done on top of this branch, but may be wrong.

The (almost) latest version is at https://github.com/vadz/swig/tree/C and
I hope to do some more work on it relatively soon after making a break to
work on something else. I hadn't started on the C++ wrapper yet however.

Regards,
VZ

Continue reading on narkive:
Loading...