Mail Archives: djgpp/1997/10/06/21:54:44
At 03:03 10/6/1997 GMT, Marsel wrote:
>Hi,
> Can I get the address of the program counter in a C program ?
I don't think there's a good way to do it directly from C, but you can do it
with external assembler, I.E. NASM. Note that this is not tested.:
-- file getip.asm --
[GLOBAL _getip]
[SECTION .text]
_getip:
mov eax,[esp] ; get the address that was pushed by the parent's CALL
ret
-- file getip.h --
unsigned getip(void);
Nate Eldredge
eldredge AT ap DOT net
- Raw text -