You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How should someone approach these situations, in which a dynamic library uses Glog, and my client application also uses Glog? They cannot both call InitGoogleLogging because that leads to a program crash.
But the dynamic library cannot drop that Logging initialization call because it can be used in applications without Glog. Shouldn't exist something like InitGoogleSharedLogging?
Moreover, how to approach cases when the shared library and the main client use different versions of a library or one of them has Glog coupled with Gflags and the other not? How to make each one point to its "rightful" library?
The text was updated successfully, but these errors were encountered:
AFAIK, dynamic libraries should not call any (third party) initialization routines. Instead, this should be application's responsibility (in the main). Only this way the order of initialization routines can be specified. By following this rule, most of the problems can be avoided.
As for the second question: why can't you make sure that exactly one version of the library is used? For instance, creating a superbuild using CMake's ExternalProject module can ensure that only a specific version of the library is shared among several projects. This eventually allows to avoid related deployment issues.
How should someone approach these situations, in which a dynamic library uses Glog, and my client application also uses Glog? They cannot both call InitGoogleLogging because that leads to a program crash.
But the dynamic library cannot drop that Logging initialization call because it can be used in applications without Glog. Shouldn't exist something like InitGoogleSharedLogging?
Moreover, how to approach cases when the shared library and the main client use different versions of a library or one of them has Glog coupled with Gflags and the other not? How to make each one point to its "rightful" library?
The text was updated successfully, but these errors were encountered: