Perl Monk, Perl Meditation | |
PerlMonks |
Re: Is this a sane/safe way to pass an aref into a C function?by syphilis (Archbishop) |
on Jan 21, 2017 at 22:56 UTC ( [id://1180097]=note: print w/replies, xml ) | Need Help?? |
Hi, Looks sane to me, but there's a portability issue in that your code requires a C99 compliant compiler. It therefore won't build for me with any of my Microsoft compilers - though I don't have a recent MS compiler to test with. (The most recent MS compiler I have is Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.41 for AMD64.) Even if I pre-declare everything and rewrite your XSub as: it still errors out with: I would work around that by dynamically allocating buf (Newxz/Safefree) but perhaps there's another way. Anyway - it's only an issue when (if) your code meets a compiler that's not C99 compliant. Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|