Page 1 of 1

getting C function adresses in ASM

Posted: Sat Mar 15, 2003 11:19 pm
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?

Re:getting C function adresses in ASM

Posted: Sun Mar 16, 2003 4:09 am
by Tim
This looks like MASM syntax. In NASM, you want:

Code: Select all

mov dword [offset], _testint

Re:getting C function adresses in ASM

Posted: Sun Mar 16, 2003 9:15 am
by stonedzealot
Agh, okay, thanks. It works now! :D