I'm working with linux64 C/C++. I have an *.so
library that has a set of API function calls (all properly defined).
All is fine if I load this library from the .exe
file without its full path (libName
) - via dlopen(libName, RTLD_LAZY)
- then dlopen()
will search, for example LD_LIBRARY_PATH
, and if it finds libName
it will load it. Then, when I call a specific API function (e.g. function1_api(HBML* handle)
), and within this function another API function is called from the same library (e.g. function2_api(HBML* handle)
) - all is OK, and I have printouts from both functions with their handles and the handles are identical.
However, if I load the library with its full path - then I have the following anomaly. The first API function that I call is fine (function1_api(HBML* handle)
), and I see my printout with a handle value. However, I do not see any printout whatsoever for the 2nd API function (function2_api(HBML* handle)
) that is called from within the first. The 2nd API function then returns an error - as if the handle it is using is not the same as the first function's handle. Here dlopen()
does not have to search for the library as its full path is given.
Any explanation of what is going on?
question from:
https://stackoverflow.com/questions/65892135/api-function-called-from-within-another-api-function-of-the-same-library-turns 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…