getting C function adresses in ASM

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stonedzealot

getting C function adresses in ASM

Post by stonedzealot »

I'm trying to get the offset of a C function so I can fill out the IDTR all right, but I can't seem to get there. The Xsism code (using C) just used (dword)nameofhandler to get the offset so I thought something along the lines of:

Code: Select all

[extern _testint] ; function defined in C
   offset dd 0
...
   mov dword offset, _testint
And, of course (or I wouldn't be writing this) it didn't work. NASM doesn't like the mov statement (invalid combo of opcode and operand) but I'm not quite sure how to cast _testint as a dword or if I'm even on the right track. Can someone give me a nudge in the right direction?
Tim

Re:getting C function adresses in ASM

Post by Tim »

This looks like MASM syntax. In NASM, you want:

Code: Select all

mov dword [offset], _testint
stonedzealot

Re:getting C function adresses in ASM

Post by stonedzealot »

Agh, okay, thanks. It works now! :D
Post Reply