It's not made any easier by what gets done behind the scenes:
use warnings;
use Inline C => Config =>
CLEAN_AFTER_BUILD => 0,
BUILD_NOISY => 1;
use Inline C => <<'EOC';
void foo1 (int x) {
Inline_Stack_Vars;
Inline_Stack_Reset;
Inline_Stack_Push(sv_2mortal(newSVuv(x * 3)));
Inline_Stack_Done;
Inline_Stack_Return(1);
}
SV * foo2 (int x) {
return newSVuv(x * 3);
}
EOC
print foo1(7), "\n", foo2(8), "\n";
Notice that foo1() specifically mortalises, while foo2() does not. Seems strange - but if you look at the C file that gets generated you'll see that the mortalisation got inserted into foo2() for you.
Although I've used an Inline::C script as a demo, it's xsubpp behaviour - nothing to do with Inline at all.
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.