flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Multiple module program

Author
Thread Post new topic Reply to topic
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
Suppose, I have written reusable module in fasm.
This module requires some imports (kernel, user and so on).

Then I want to include this module in my main program module.
Can I declare imports required for reusable module in that reusable module and include them in the main program?
Or I can only declare all of the imports from all modules in the main program?

Is the following code legal:

Code:
library user32,'USER32.DLL'
library user32_module1,'USER32.DLL'

import user32, \
        DefWindowProc,'DefWindowProcA'

import user32_module1, \
        CreateWindowEx,'CreateWindowExA', \
        GetMessage,'GetMessageA'
    
[/code]
Post 02 Jan 2007, 11:13
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you can develop set of macros, which will collect list of imports. There were such macros some time ago, but they were very slow.

In my opinon, declaring imports once per project is not that much pain to make such solutions for it.
Post 02 Jan 2007, 11:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
also note that when external symbols are declared only in main file, your module is even more reusuable. For example you can compile it to object, and then link with libraries.
Post 02 Jan 2007, 11:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
1. And what about reusable projects? (Which can not be compiled into the library due to some reasons).

2. What if my main file does not use some of the functions implemented in the project? Will they be included in object module?
Post 02 Jan 2007, 11:39
View user's profile Send private message ICQ Number Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
Quote:

In my opinon, declaring imports once per project is not that much pain to make such solutions for it.



For example, I implemented framework for developing ActiveX control (like ATL). To create control it is ehough to type
Code:
stdcall CreateObject, \
    0, \
    sizeof.CMyControl, \
    CControlImpl_InterfaceMap, \
    CControlImpl_TableMap
    


But it requires also declaration of all imports used by whole framework. So using library modules in fasm requires A LOT OF TYPING. I think it is wrong.
Post 02 Jan 2007, 11:52
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
1. And what about reusable projects? (Which can not be compiled into the library due to some reasons).
what do you mean by "reusuable project"?

Quote:
2. What if my main file does not use some of the functions implemented in the project? Will they be included in object module?
Depending on way you chose to use the module. If you are speaking about linking object - yes, they everything be present. If you link library (more object files compiled to single file), then only object files actually used will be present.

Quote:
For example, I implemented framework for developing ActiveX control (like ATL). To create control it is ehough to type [...] but it requires also declaration of all imports used by whole framework. So using library modules in fasm requires A LOT OF TYPING. I think it is wrong.
are you sure? sounds extremely weird? why?
Post 02 Jan 2007, 12:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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.