News

The C language allows you to provide a pointer to a function, just like a pointer to a variable. In both cases, a C pointer contains the address and the type information about the entity being pointed ...
Why a PyObject? All Python data types derive from PyObject, which makes it a handy lowest-common denominator. Therefore, almost all of the functions that you'll deal with when interacting with the ...
As a result, we can declare a function pointer variable fptr and assign a function func() to it: fptr = func;. Calling fptr(); will then resolve to the entry point of function func() and execute it.
I'm trying to cast my function to an int, add an offset, and cast it back to a function pointer (I don't plan on calling the pointers).
You simply cannot guarantee correct behaviour when you do this. You have guarantee how the ABI is going to pass arguments to functions. If it happens to store the return pointer at the top of the ...