|Don't ask to ask, just ask|
Inline::C and NULL pointersby markong (Pilgrim)
|on Dec 19, 2021 at 00:09 UTC||Need Help??|
markong has asked for the wisdom of the Perl Monks concerning the following question:
I have to investigate the functionality of a C library and while in the past I always used SWIG to interface with C/C++ code, I am now trying to use Inline::C instead to save time on the "interface compilation" phase, seen that I'm only interested in experimenting with the C functions and copy/paste is not a problem.
All is good except I don't see how to "pass a NULL pointer from Perl". SWIG resolves by passing undef but Inline::C explodes on that, e.g.:
This results in:
At least we have compiled a bit of C code! Use of uninitialized value in subroutine entry at script/decode_test.pl line 12. Segmentation fault (core dumped)I see that SWIG provides some custom type mappings for all the bindings, so unless I re-use those I am probably out of luck and have to write one for my use case? I wonder how it comes that nobody has ever had to pass a NULL pointer or have I overlooked something in Inline::* docs ?