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 > how do i output object files?

Author
Thread Post new topic Reply to topic
luna7ic



Joined: 26 Oct 2017
Posts: 3
how do i output object files?
i need to output my fasm code tp object code so i can link it to my c code.
how do i do that? I plan on doing inline assembly using fasm.
Post 26 Oct 2017, 22:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15312
Location: Bigweld Industries
The output type is controlled by format.

Code:

; example of making Win32 COFF object file

format MS COFF

extrn '__imp__MessageBoxA@16' as MessageBox:dword

section '.text' code readable executable

 public _demo

 _demo:
        push    0
        push    _caption
        push    _message
        push    0
        call    [MessageBox]
        ret

section '.data' data readable writeable

 _caption db 'Win32 assembly',0
 _message db 'Coffee time!',0

See the "EXAMPLES" folder for more examples of output formants.
Post 26 Oct 2017, 22:24
View user's profile Send private message Visit poster's website Reply with quote
Kenneth Zheng



Joined: 30 Apr 2008
Posts: 13
Location: Shanghai, China
another method is used DLL file. Please reference below steps for it:
1. Based on C:\fasm\examples\DLL\errormsgs.asm to cto insert your ASM API into it and then create export API in the DLL file.
2. C code uses two APIs "LoadLibrary() and GetProcAddress()" API to invoke DLL's API.

Thanks.

Kenneth Zheng

_________________
Pure Assembly Language Funs
Post 27 Oct 2017, 06:59
View user's profile Send private message MSN Messenger 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.