Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8273575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:31:28+00:00 2026-06-08T07:31:28+00:00

I know almost no C++ so that’s not helping, and my XS isn’t much

  • 0

I know almost no C++ so that’s not helping, and my XS isn’t much better. I’m creating an XS interface for a C++ library and I have almost all my methods working except one.

The method in Perl should look like this:

$return_data = $obj->readPath( $path );

The method is defined as this the .h file:

int readPath(const char* path, char* &buffer, bool flag=true);

The “buffer” will get allocated if it’s passed in NULL.

There’s two additional versions of readPath with different signatures, but they are not the ones I want. (And interestingly, when I try and compile it tells me the “candidates” are the two I don’t want.) Is that because it’s not understanding the “char * &”?

Can someone help with the xsub I need to write?

I’m on Perl 5.14.2.

BTW — I’ve also used a typemap “long long int” to T_IV. I cannot find any documentation on how to correctly typemap long long. Any suggestions how I should typemap long long?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:31:30+00:00Added an answer on June 8, 2026 at 7:31 am

    I’ve never dealt with C++ from C or XS. If it was C, it would be:

    void
    readPath(SV* sv_path)
       PPCODE:
          {
             char*  path   = SvPVbyte_nolen(sv_path, len);
             char*  buffer = NULL;
    
             if (!readPath(path, &buffer, 0))
                XSRETURN_UNDEF;
    
             ST(0) = sv_2mortal(newSVpv(buffer, 0));
             free(buffer);
    
             XSRETURN(1);
          }
    

    Hopefully, that works or you can adjust it to work.


    I assumed:

    • readPath returns true/false for success/failure.
    • buffer isn’t allocated on failure.
    • The deallocator for buffer is free.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a simple question: I know and have heard from almost everyone that
I must say, that I know almost nothing about TFS. But have worked with
So far in my web developing experiences, I've noticed that almost all web developers/designers
I know that almost everything is already said about CMSs, but what interests me
i know almost anything about sub-domains and dns records. i have heard about them
All the documentation I can find suggests that almost standards mode differs from standards
I just noticed that almost all the key values in property files are in
Does anyone know that when you have autosync enabled, how frequently are the google
I can see that almost all modern APIs are developed in the C language.
I know almost nothing about SVG files, but have to use one in order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.