graphitemaster / incbin

Include binary files in C/C++
The Unlicense
938 stars 87 forks source link

Incorrect symbol names #20

Closed IngwiePhoenix closed 8 years ago

IngwiePhoenix commented 8 years ago

Just after you fixed the incbin tool problem, I updated and re-compiled my source using the script - the tool itself works again, thanks for that :).

But now I have a more awkward problem:

src/IceTea.cpp:154:29: error: use of undeclared identifier 'gSTDData'
        {"std.os",          INCBIN_DATA(STD),           INCBIN_LEN(STD)},
                            ^
src/IceTea.cpp:20:27: note: expanded from macro 'INCBIN_DATA'
#define INCBIN_DATA(name) g ## name ## Data
                          ^
<scratch space>:356:1: note: expanded from here
gSTDData
^

I was so confused that it took me a while untill I actually realized how I could best test this. I took the file containing the INCBIN statements and wrote a teensy tiny C++ program:

#include "scripts.rc"
int main() {
  return 0;
}

Nothing special going on - except script.rc, which is the header in which I have my incbin statements. the .rc is probably misleading, but it makes me think of resource container. So that works for me - besides, it has worked for a logn time now :).

After compiling this tiny program, I inspected the symbol table...and:

Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ nm t
0000000100000000 T __mh_execute_header
00000001000014f0 s _gConfigurable0_0_DATA
00000001000015a8 s _gConfigurable0_0_END
00000001000015b0 s _gConfigurable0_0_SIZE
000000010000a860 s _gInternalBootstrapIt0_0_DATA
000000010000d0ee s _gInternalBootstrapIt0_0_END
000000010000d0f0 s _gInternalBootstrapIt0_0_SIZE
0000000100001000 s _gSTD0_0_DATA
00000001000014de s _gSTD0_0_END
00000001000014e0 s _gSTD0_0_SIZE
00000001000015c0 s _glibIceTea0_0_DATA
000000010000a84b s _glibIceTea0_0_END
000000010000a850 s _glibIceTea0_0_SIZE
0000000100000f90 T _main
                 U dyld_stub_binder

0_0_DATA and such! Now, that does explain why my tiny helper macro did no longer work. :)

Looking into incbin.h, this also does not seem to be the intended behavior either. Could you look into this please? This basically broke my app for now. ^^"

graphitemaster commented 8 years ago

That is odd, is there a better forum for us to communicate on. IRC?

IngwiePhoenix commented 8 years ago

I have skype, and there is also Gitter.

graphitemaster commented 8 years ago

Think I fixed it

graphitemaster commented 8 years ago

Try now

IngwiePhoenix commented 8 years ago

Nice!

Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ nm t
0000000100000000 T __mh_execute_header
00000001000014f0 s _gConfigurableData
00000001000015a8 s _gConfigurableEnd
00000001000015b0 s _gConfigurableSize
000000010000a860 s _gInternalBootstrapItData
000000010000d0ee s _gInternalBootstrapItEnd
000000010000d0f0 s _gInternalBootstrapItSize
0000000100001000 s _gSTDData
00000001000014de s _gSTDEnd
00000001000014e0 s _gSTDSize
00000001000015c0 s _glibIceTeaData
000000010000a84b s _glibIceTeaEnd
000000010000a850 s _glibIceTeaSize
0000000100000f90 T _main
                 U dyld_stub_binder
IngwiePhoenix commented 8 years ago

Just ran against my app, works again. Thanks. :)