Message board for the users of flat assembler.
> Main > extrn question
kamac 12 Dec 2013, 19:28
I've got a question about extrn. Why do I seem to have to use:
extrn 'myFunc' as myFunc:dword
When I'm combining two FASM-generated .obj files? I must extern all other functions that seem to come from .a libraries with the 2nd convention, and those that come from .obj files with 1st convention? Is there a way to change that?
Btw. I'm compiling with format MS COFF.
Actually, it does work, but I must call the function this way:
rather than this:
Well, I guess it's mean to be this way. Though, if anybody knows a way to force the call to include [ ], I'd appreciate it.
Same goes for FASM-generated .a libs. Consider this example:
format MS COFF extrn '__imp__printf' as printf:dword section '.text' code customFunc: push dbg call [printf] add esp,4 ret
Then, I generate an .obj file by:
FASM customFunc.asm customFunc.obj
Then, I generate an .a file:
ar rcs libcustomfunc.a customFunc.obj
Then, I must do this to make it work:
format MS COFF extrn 'customFunc' as customFunc:dword section '.text' code _start: call customFunc ret
Why is that? Why do I have to call printf by using the [ ], and I mustn't use them with my own function taken from shared library?
Okay, I read this topic:
And now I kinda understand.. But is there any way for me to declare extern printf and call it without the brackets?
extrn '__imp__printf' as printf:dword
|12 Dec 2013, 19:28||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.