flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
vid
you can't define equates externally, this was already discussed somewhere on board. FASM's philosophy is that contents of generated file depends ONLY on contents of source file. It's quite easy to define it somewhere by the beginning of file.
|
|||
![]() |
|
james
Vid,
thanks, but then its not conditional. No need for match then. rgs, james. |
|||
![]() |
|
Tomasz Grysztar
You can have environment variable with the name of include file, like DEBUG=debug.inc or DEBUG=nul, and then include it like:
Code: include '%DEBUG%' |
|||
![]() |
|
james
Tomasz,
Setting an environment variable seems a little much when trying to do conditional preprocessing. I was hoping you could do a "-d os=win32" on the command line and then in code do a Code: match =win32, OS { include 'win32ax.inc' } This seems to be a defacto standard approach, but I appreciate FASM is different and "flat". I can get around this with a batch (.bat) file and a shell script (.sh) but it doesnt seem as elegant. BTW Tomasz, any chance of an example source to making a shared library under linux ? Rgs, James. |
|||
![]() |
|
james
Can anyone show a working example using match ?
|
|||
![]() |
|
revolution
You can also use something like this:
File MyApp-osWIN32.asm: Code: OS equ WIN32
include "MyApp.asm" File MyApp-osLINUX.asm Code: OS equ LINUX
include "MyApp.asm" File MyApp-osWIN32-debug.asm: Code: OS equ WIN32
DEBUG equ TRUE
include "MyApp.asm" File MyApp-osLINUX-debug.asm Code: OS equ LINUX
DEBUG equ TRUE
include "MyApp.asm" File MyApp.asm: Code: match =WIN32,OS {;stuff for win32 goes here} match =LINUX,OS {;stuff for linux goes here} match =TRUE,DEBUG {;debugging stuff goes here} |
|||
![]() |
|
revolution
Also try this:
File FASM-debug.bat: Code: @echo DEBUG equ TRUE >FASM-debug.abc @echo include '%1.asm' >>FASM-debug.abc @fasm FASM-debug.abc %1.exe @del FASM-debug.abc |
|||
![]() |
|
james
thanks for the examples. They help me a lot.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.