http://qs1969.pair.com?node_id=197028

kilinrax has asked for the wisdom of the Perl Monks concerning the following question:

Interfacing C++ and Perl seems to be a somewhat underdocumented subject; so far I have only managed to find the following:

  1. John Keiser's Gluing C++ And Perl Together
  2. Dean Roehrich's XS CookBooks
However, neither of these really touch on writing frontends to C++ libs, just standalone code.

If anyone can suggest a better forum for this, or source of documentation specific to what I'm trying to do, when please tell me. If not, and you have any experience of what I'm trying to do, read on ...

I've been comsistently encountering two errors - one of which occurs whenever I try and access an overloaded method, e.g:

MyModule.c:64: no matching function for call to `Mysettings::set (cons +t string *, const string *)' /usr/local/include/mysettings.h:66: candidates are: void Mysettings::s +et(const string &, const string &) /usr/local/include/mysettings.h:74: void Mysettings::s +et(const string &, const char *) /usr/local/include/mysettings.h:82: void Mysettings::s +et(const string &, int) /usr/local/include/mysettings.h:90: void Mysettings::s +et(const string &, double) /usr/local/include/mysettings.h:98: void Mysettings::s +et(const string &, bool)

The second occurring when accessing methods which return an object of a differing class to the owner of the method, e.g

MySet MyEnquire::get_set(first, maxitems)
Produces the error:
MyModule.c: In function `void XS_MyModule__Enquire_get_set(CV *)': MyModule.c:567: cannot convert `RETVAL' from type `MySet' to type `voi +d *

I've tried googling for '"cannot convert `RETVAL' from type `MySet"', which turns up absolutely no results; and '"no matching function for call to" XS', which turns up ones of little relevance.

Anyone know how to deal with these problems?

n.b. Before anyone suggests it, I have tried generating the XS code with SWIG, but had even less success with it.