
Rune Torgersen wrote:
Wow.... This surprises me... I have alwayts thought that *test and test[] would be the same thing.
Only solutionI can see is to change the definition in common.c to be *test, this will still get the address of test[] defined elsewhere. (See attached files)
Sure, I've tried this. This is the point, where my problem arose. Attached you find two small files, you can easily compile under linux (gcc -o arrtest -I ./ ./common.c ./array.c). The file "common.c" represents the code I can't (don't want to) touch. "array.c" represents my project dependent code. If you run arrtest it will show to you,
With the patch in place (previously sent to the list), it works for linux:
vanbaren@sherwood:~/x> ll total 32 -rwxr----- 1 vanbaren users 200 Jun 30 13:24 array.c -rwxr-xr-x 1 vanbaren users 8963 Jun 30 13:26 arrtest -rwxr----- 1 vanbaren users 132 Jun 30 08:03 common.c -rwxr----- 1 vanbaren users 121 Jun 30 08:03 common.c-original -rw-r--r-- 1 vanbaren users 237 Jun 30 08:04 common.c.diff -rwxr----- 1 vanbaren users 24 Jun 30 13:23 common.h vanbaren@sherwood:~/x> gcc -o arrtest -I ./ ./common.c ./array.c vanbaren@sherwood:~/x> ./arrtest *test: 0x08048558 test[]: 0x08048558
gvb