flat assembler
Message board for the users of flat assembler.
Index
> Windows > Having trouble using C variables from FASM on windows |
| Author |
|
|
revolution 01 Jan 2026, 20:18
The C code has helloMessage as a pointer, so:
Code: mov rcx, [helloMessage] |
|||
|
|
therektafire 01 Jan 2026, 21:23
revolution wrote: The C code has helloMessage as a pointer, so: Oh yeah duh, that makes sense lol. I do still technically have another issue though. When I add Code: -ffunction-sections -fdata-sections -Wl, --gc-sections to my compile options I get an undefined reference to printf error in the asm. What would cause that when the function shouldn't be getting stripped out since it's also being used in C as you can see in the code I originally posted? Is it just renaming the function to something else? It doesn't seem to have done the same thing to helloMessage so i'm pretty confused |
|||
|
|
therektafire 01 Jan 2026, 22:43
Never mind, I was finally able to figure it out, I enabled LTO and the LTO actually optimized out printf from the C code because it noticed I wasn't using any actual formatting in there and replaced it with puts, replacing the call to printf with puts allowed it to compile again. Though I'm noticing my c + asm test program is twice as big as the c only one for some reason, 251kb vs 117kb
edit: actually wait, it didn't replace printf with puts, it replaced printf with... __mingw_printf. UUUUGH |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.