Hello,
while trying to find out the reasons of a strange behaviour of my library, I stumbled upon this:
cpp file 1 of library:
void printRelativeFunctionAddresses()
{
printf("printRelativeFunctionAddresses-giveMeAOne: %i\n",int(printRelativeFunctionAddresses)-int(giveMeAOne));
printf("printRelativeFunctionAddresses-giveMeATwo: %i\n",int(printRelativeFunctionAddresses)-int(giveMeATwo));
}
Cpp file 2 of library:
extern "C" __attribute__((visibility("default"))) int giveMeAOne()
{
return(1);
}
extern "C" __attribute__((visibility("default"))) int giveMeATwo()
{
return(2);
}
the function printRelativeFunctionAddresses prints the same value everytime I start the library from a specific client application A. But when I use a different client application B (but that loads the exact same library), then the output is different! How can that be? Are functions shifted around during the library load operation?
I am running the library on Ubuntu 32bit, using Qt5.1.0