I would like to execute some assembly instructions based on a define from a header file.
Let's say in test.h
I have #define DEBUG
.
In test.asm
I want to check somehow like #ifdef DEBUG
do something...
Is such thing possible? I was not able to find something helpful in the similar questions or online.
Yes, you can run the C preprocessor on your asm file. Depends on your build environment how to do this. gcc
, for example, automatically runs it for files with extension .S
(capital). Note that whatever you include, should be asm compatible. It is common practice to conditionally include part of the header, using #ifndef ASSEMBLY
or similar constructs, so you can have C and ASM parts in the same header.
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