in reply to Return array or list from an XSUB?
You can return an array ref by specifying an AV* return type - see this section of perlxs (take note of the remark about refcounts).
Returning lists is a bit more involved, lookup XPUSH in perlxstut and perlapi
So in short, returning an array ref is easier to code and can be significantly more efficient if you're returning a lot of values, but it can also be "uglier" to use, especially if you're returning multiple values that really are mostly used as different things instead of a big list.
Returning a list is more work to code, but may lead to a nicer API for the perl side.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Return array or list from an XSUB?
by syphilis (Archbishop) on Nov 14, 2007 at 13:41 UTC | |
by chromatic (Archbishop) on Nov 14, 2007 at 16:55 UTC | |
|
Re^2: Return array or list from an XSUB?
by smee30 (Initiate) on Nov 14, 2007 at 12:32 UTC | |
by Joost (Canon) on Nov 14, 2007 at 12:45 UTC | |
by smee30 (Initiate) on Nov 14, 2007 at 12:57 UTC |