Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Some functions in .xs file can't be found

by BrowserUk (Pope)
on Nov 13, 2013 at 01:44 UTC ( #1062292=note: print w/ replies, xml ) Need Help??


in reply to Some functions in .xs file can't be found

The function is defined as returning void, but then you call XSRETURN(1)

Change:

void TagLib::ID3v2::Tag::header()

To:

SV* TagLib::ID3v2::Tag::header()

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Some functions in .xs file can't be found
Select or Download Code
Re^2: Some functions in .xs file can't be found
by ikegami (Pope) on Nov 13, 2013 at 15:05 UTC

    No, it should be void. The C function doesn't return anything.

    #define XSRETURN(off) \ STMT_START { \ const IV tmpXSoff = (off); \ PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1); \ return; \ } STMT_END

    There are two ways of returning to Perl from an XS function:

    • Place it on the Perl stack.
      void foo() { ... mXPUSHs(sv); }
    • Return it from the C function. The typemap will place it on the Perl stack after any conversion and mortalizing it performs.
      SV* foo() { ... return sv; }

    The OP's code uses the former approach.

      Indeed. Thanks for the correction.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062292]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2015-07-04 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls