How do I get the address of a function? #10780
-
Say:
Is the above the physical address of the function or it is the address of the object? If the latter, is there a way to retrieve the physical address of the function itself? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
Can you explain what you want to achieve? That number is a C memory address, which isn't going to be of much use in Python. |
Beta Was this translation helpful? Give feedback.
-
Looking for it in the code at py/binary.c, there are three type codes, 'P', 'O' and 'S', which have the size of a void * and are not defined otherwise in CPython. According to the comments, 'O' stand for an array of objects, 'P' for an array of pointers. No comment about 'S'. |
Beta Was this translation helpful? Give feedback.
-
@rkompass wrote:
I will mark this thread as answered by the message quoted above. I implemented a class to program the alarm interruption, using the inspect function as a basis to install a Viper handler, but MP hangs when the interrupt occurs, probably because I am calling an MP function inside the Viper handler. I need to do a small test lighting a LED (direct access to the GPIO pin with mem32 or ptr32) just to confirm it but I think I will pursue a different approach (e.g., extending the Timer class in C). |
Beta Was this translation helpful? Give feedback.
@rkompass wrote:
I will mark this thread as answered by the message quoted above. I implem…