http://www.perlmonks.org?node_id=755906


in reply to Re: weird XS_unpack_charPtrPtr error
in thread weird XS_unpack_charPtrPtr error

I had the word static in the declaration of a function, but not in its subsequent definition

With Inline::C, function declarations are usually unnecessary. I wouldn't go so far as to say that they're *never* needed, but I've not yet struck a situation where they're required.

with the static keyword on a separate line

It's a bug that having 'static' on a separate line is producing different behaviour. In fact, I think it's a bug in the Parse::RecDescent parsing of the code - if you parse with ParseRegExp the problem disappears. ParseRegExp is a much faster parser, too. You use it by specifying the Inline config option USING => 'ParseRegExp',
(ParseRegExp is broken in Inline-0.44, but works fine for me in Inline-0.45.)

I'm not sure if it's a bug or a feature that the static keyword makes the function invisible from perl, but that's certainly the way it is for me. I'm still a little bit puzzled that you needed to use static to get the desired effect. I've written plenty of Inline::C functions that are uncallable from Perl, and haven't had to do anything like that. Of course, if I call them from Perl, then I get a runtime error straight away - and they do have to be defined in the script *before* any of the other Inline::C functions that call them.

Anyway, good that you got it working - and I much appreciate your feedback.

Cheers,
Rob