I am looking for some preprocessor functionality in nasm that would allow having one source code for both x86 and x64 architectures.
I mean something in the vein of ifdef some_constant. Like C preprocessor uses if it wants to detect say if it's compiled on Windows or Linux.
I know about nasm flags. I use them. I just want to have the very same source code and expect preprocessor to handle it correctly based on those flags. I'd use ifdef ... else for stack operations and so one, having the core code same for both architectures.
__OUTPUT_FORMAT__
http://www.nasm.us/doc/nasmdoc4.html#section-4.12.6
The
__OUTPUT_FORMAT__
standard macro holds the current Output Format, as given by the-f
option or NASM's default. Type nasm-hf
for a list.%ifidn __OUTPUT_FORMAT__, win32 %define NEWLINE 13, 10 %elifidn __OUTPUT_FORMAT__, elf32 %define NEWLINE 10 %endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With