I have recently used GPUImage to do the beauty function. The name of the class has been changed to prevent conflicts, but some global variables have not been noticed and have not been renamed. What we do is the SDK static library, as a result, after I gave the library out, the third party also used GPUImage, to compile the link and did not report a conflict, but the program died when it ran. Later, I followed for a while, and the reasons for the collapse were as follows:
//
// BT.709, which is the standard for HDTV.
const GLfloat kColorConversion709[] = {
1.164, 1.164, 1.164,
0.0, -0.213, 2.112,
1.793, -0.533, 0.0,
};
reference with extern in another file
extern const GLfloat kColorConversion601[];
use this worthwhile place, pinch breakpoint debugging, normal _ preferredConversion assignment is 1, when there is a problem, can not get the value from kColorConversion601 memory, access memory crash:
_preferredConversion = kColorConversion601;
question:
- there are two global variables mentioned above in SDK, and there are no compilation link errors. What is the reason for this? can you tell me the specific process of compiling links?
- guess that there are two copies of the same variable, and the address is wrong when looking for the variable. What exactly is the process? I would like to know .
- if you adjust the link order of the library, the problem of collapse can be solved, which feels strange
I hope to know what my friends tell me. Although the problem has been found and solved, I would like to know why. -sharp-sharp-sharp problem description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)