3

I want to make a near, relative call to a function from another object file:

; a.asm
global _func
_func:
; [..]

; b.asm
extern _func
; [..]
call _func

Unfortunately, the code above doesn't work. I need to load _func into a register:

mov  eax, _func
call eax

Both files are compiled to COFF object files. Is there any way to make a near, relative call without loading the function address into a register?

0xbadf00d
  • 17,405
  • 15
  • 67
  • 107

1 Answers1

0

In a.asm, the line:

func:

should be:

_func:

Just tested in a very contrived case and it works for me. No need to load the function address into eax. For the record, doing so didn't work around the above symbol error, so perhaps that's a typo and I missed the broader issue.

Multimedia Mike
  • 12,660
  • 5
  • 46
  • 62