in reply to Re^8: Inline::C and NULL pointers
in thread Inline::C and NULL pointers
I agree with this: I'm not convinced that the need to pass NULL pointers from perl to C functions is all that common.
As I mentioned in previous posts, the OP is confronted with some poorly written C code that he can't change. This NULL pointer idea arises from an I/F that says: "if you give a pointer to memory, I will use that memory for output, assuming without question that you have given me enough memory for my yet to be generated output. If you don't give me such a pointer, I will give you a pointer to my non-thread-safe non-recursion-safe static memory." This is a bullshit I/F. But the OP can't change that.
NULL as the 2nd param is a weird situation. If there could be one arg and an optional second arg, then normally this would be implemented with a variable number of args - you don't put NULL, for that second arg - it is simply not there at all for the caller. This of course requires different C code than what the OP is dealing with. printf() for example uses a variable number of arguments.
I did have fun with Inline::C and found it to be "easy to use" for all the "heavy lifting" that is does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Inline::C and NULL pointers
by etj (Priest) on Dec 21, 2021 at 14:52 UTC | |
by Marshall (Canon) on Dec 27, 2021 at 22:28 UTC | |
by etj (Priest) on Dec 28, 2021 at 00:36 UTC |