One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314
stars
39
forks
source link
Small improvement for INCBIN: report included file's size #77
So as the subject says, I wanted to know the sizes of the various files I include using the INCBIN or INCBIN_CHIP macros. Here's my solution, it's not perfect but at least it works for me! Perhaps if you find it useful you can improve my ignorant hacks!
So what does this get us? Well, incbin_name_size seems to have the correct value, but no matter what type I would try, make it a pointer or not, it would assume it's a pointer. This was the only compromise I could find, and then using it in the code is also bizarre. For example:
I.e. I take the pointer, take its address, then cast it to an integer and then I have the value! (I think if I wrote ULONG *incbin_ ## name ## _size; then I couldn't even do that, it still assumed it's a pointer).
Anyway, IMO it's a worthy addition to the macros but I'm at the moment unsure how to make this more proper than the above version!
Hi,
So as the subject says, I wanted to know the sizes of the various files I include using the INCBIN or INCBIN_CHIP macros. Here's my solution, it's not perfect but at least it works for me! Perhaps if you find it useful you can improve my ignorant hacks!
So what does this get us? Well,
incbin_name_size
seems to have the correct value, but no matter what type I would try, make it a pointer or not, it would assume it's a pointer. This was the only compromise I could find, and then using it in the code is also bizarre. For example:I.e. I take the pointer, take its address, then cast it to an integer and then I have the value! (I think if I wrote
ULONG *incbin_ ## name ## _size;
then I couldn't even do that, it still assumed it's a pointer).Anyway, IMO it's a worthy addition to the macros but I'm at the moment unsure how to make this more proper than the above version!