Reputation: 135
I have an array in my code which is not called by any function but I need this array, as it is array of address of executables, which microprocessor will call
My query is while I compile the array it is visible in .a file (library) but when I link all the .a files this array does not comes in the final .bin file. It comes when I use it somewhere but otherwise it is not coming in final .bin file
Upvotes: 0
Views: 42
Reputation: 12422
The linker only includes used objects in the final binary, if the array isn't used it won't be included.
Cast it to void somewhere:
main()
{
(void)funcarray;
}
then it will count as being used.
Upvotes: 1