flat assembler
Message board for the users of flat assembler.

Index > Main > PROTO equivalent for FASM

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hello,

I have an application with several modules (MS COFF OBJs). I have some functions declared in some modules and I want to call them from another module.

In MASM, we have the PROTO directive which we use to declare our functions from another modules. Like:

MyFunc1 PROTO :DWORD, :DWORD...

How can I import in my .asm module another functions from my other .asm modules? Should I use EXTRN MyFucnX:DWORD, or there is a better way in FASM?

Thanks.
Post 05 Jan 2006, 16:07
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7782
Location: Kraków, Poland
Tomasz Grysztar
You should use EXTRN, but without ":DWORD".
Post 05 Jan 2006, 16:09
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hello Tomasz,

Thanks for the hint.

If I declare it with just EXTRN (without ":DWORD") I get the following error when called via:

invoke MyFunc, Param1, Param2

--
Error: Proc32.ini [20] invoke [6]:
call [proc] }
operand size not specified
--

So, I have to put the :DWORD for the procedure. Is this OK then?

Thanks.
Post 05 Jan 2006, 16:16
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7782
Location: Kraków, Poland
Tomasz Grysztar
You should use "stdcall" macro for such calls, not "invoke". "invoke" uses the pointer variable to call the procedure, while "stdcall" calls the procedure directly.

I stronglly recommend reading through the documentation, also in PDF format included in the fasm for Windows package.
Post 05 Jan 2006, 16:38
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.