Fix segfaults in GCC when using the C-API

Relevant details are in the commit log.  This is the pull request addressing the issues (and promised by) issue #318.

A direct comparison between the generated C wrapper files indicates that only the ``reinterpret_cast<const std::string*>`` chunks were replaced with ``std::string(thing)``.