Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Writing XS frontends to C++ libraries. by kilinrax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found