flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > Can I include library code without using third-party linker?

Author
Thread Post new topic Reply to topic
Jin X



Joined: 06 Mar 2004
Posts: 27

Can I include library code without using third-party linker?

Hello!
Can I include library code without using third-party linker?
Post 04 Apr 2018, 09:23
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15633
Location: Thasus

There is the file directive in fasm, so it could be done in theory. But you would have to write your own processing code (i.e. load, store, etc.) because AFAIAA no one else has done it yet.
Post 04 Apr 2018, 09:38
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 27

revolution, file??? I'm saying about library, not raw data.
Post 04 Apr 2018, 10:08
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 204
Location: Belarus


Jin X wrote:
revolution, file??? I'm saying about library, not raw data.



revolution wrote:
But you would have to write your own processing code (i.e. load, store, etc.)

Post 04 Apr 2018, 10:13
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15633
Location: Thasus


Jin X wrote:
revolution, file??? I'm saying about library, not raw data.

Yeah, but a library is really just a file on disc. It can be parsed within fasm source code with file, load, store, virtual, etc.
Post 04 Apr 2018, 10:13
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 27


revolution wrote:
It can be parsed within fasm source code with file, load, store, virtual, etc.

It's too mad idea Smile
I'm asking about build-in solution...
Post 04 Apr 2018, 10:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15633
Location: Thasus


Jin X wrote:
I'm asking about build-in solution...

It currently doesn't exist. Hence the other suggestion.
Post 04 Apr 2018, 10:21
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6770
Location: Kraków, Poland


Jin X wrote:

revolution wrote:
It can be parsed within fasm source code with file, load, store, virtual, etc.

It's too mad idea Smile
I'm asking about build-in solution...

It is not so mad, in fact I have been considering writing some linking macros for fasmg (as all the formatters for fasmg are also in form of macros already). And since the directives that revolution mentioned would suffice for such purpose, such macros could probably be ported to fasm 1 too, because these directives are mostly compatible between fasm 1 and fasm g.
Post 04 Apr 2018, 10:26
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 27

Ok, but can I use includes like win32a.inc for MS COFF output format (to link it with library that I need by external linker)?

The following codes don't work...

Code:
format MS COFF

include 'win32axp.inc'

.code
 
start:

                invoke  MessageBox0'Hello!''Hi'MB_OK or MB_ICONWARNING or MB_TASKMODAL or MB_SETFOREGROUND
                invoke  ExitProcess0

.end    start




Code:
format  MS COFF

include 'win32axp.inc'

.code
 
start:

                cinvoke printf, <'Hello World!',13,10>
                invoke  ExitProcess0

section '.idata' import data readable

library kernel32'kernel32.dll',\
        msvcrt'msvcrt.dll'

        import_kernel32
        all_api
 
import  msvcrt,\
        printf'printf'

Post 04 Apr 2018, 10:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15633
Location: Thasus

"MS COFF" doesn't work like that. Instead you need to use extrn and public. The linker handles all the other stuff like kernel32 etc.
Post 04 Apr 2018, 10:48
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


Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.