I am working on a Swig interface to Cppad. The goal in using a Swig is to
have a single source that supports as many target languages as possible. The example / tests are written in M4 and translated to each of the target languages for example / testing purposes; see http://www.seanet.com/~bradbell/cppad_swig/xam.m4.htm For example, see the heading Example on http://www.seanet.com/~bradbell/cppad_swig/a_fun_jacobian.htm#Example where there is a link for C++, Octave, Perl, and Python. Is there some other approach to example / tests that is used by the Swig community ? One thing that I have had trouble with is handling exceptions in a target language independent way. I know the %except directive http://www.swig.org/Doc1.1/HTML/Exceptions.html is intended for this purpose, but I was not able to figure out how to use it in a target language independent way. Perhaps there are examples of how to do this ? I took the following approach to exceptions: http://www.seanet.com/~bradbell/cppad_swig/error_message.htm Note the Example heading and that it works in a language independent way. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
On 20 January 2017 at 02:29, Brad Bell <[hidden email]> wrote: I am working on a Swig interface to Cppad. The goal in using a Swig is to You are looking at documentation for a rather ancient version of SWIG. Exceptions are covered in various places in the docs. http://www.swig.org/Doc3.0/Customization.html#Customization_exception and http://www.swig.org/Doc3.0/SWIGPlus.html#SWIGPlus_exception_specifications are probably the two most useful sections describing various ways that exceptions can be handled. William ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
The problem with the solution below is
that the C++ code depends on the target language. I would like to
write one C++ exception handler that swig maps to the proper
interface for each language. This is what the
http://www.seanet.com/~bradbell/cppad_swig/error_message.htm does. The corresponding source code can be found starting at error_message(const char* input_message) in the file https://github.com/bradbell/cppad_swig/blob/master/lib/error.cpp On 03/10/2017 05:09 PM, William S Fulton wrote: ... snip ...
------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
Free forum by Nabble | Edit this page |