Welcome to the Monastery | |
PerlMonks |
Re: perl XS - passing array to C and getting it backby BrowserUk (Patriarch) |
on Mar 29, 2016 at 12:21 UTC ( [id://1159003]=note: print w/replies, xml ) | Need Help?? |
return the array You cannot return an array from a C function. Your c code example is returning the modified value of the first element of the array passed (by reference). That means that in the following C calling code:
After the call, rv would contain 1.0, the modified value of ary 0 ; and ary would have been modified to contain 10 x 1.0. So what do you want the function -- as seen from Perl - to do?
All of these are possible, but only the first can be written in C alone; all the others would need to be written in XS code. 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". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|