I want to compile multiple assembly files in fasm. I have some instructions in the one file and other instructions in the other file. How do I link these files to a binary output ?
And may I use extern in this case ? Or is this an illegal command ?
I want to compile multiple assembly files in fasm.
So you have multiple .ASM source files.
include
preprocessor directive for every additional source file that you want in your single binary output file. Example with 3 source files
; Main source is 'source1.asm'
include 'source2.asm'
include 'source3.asm'
...
I generally create an includes file (much like a header for my application) and simply include that file which lists all files to be "included".
include 'includes.inc'
The includes.inc will then, itself, have all the relevant inclusions listed for a "project style" structure.
This is an alternative approach to what Fifoernik states (which is correct).
I also like to externalize data segments as well (especially when developing for Windows) into vars.inc (read & write permissions, no execution) and const.inc (read only with no write or execution permissions). Something else to ponder on a side note.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.