I have two static libraries that use the LLVM command line to parse arguments:
// lib1 void main(int argc, const char **argv) { cl::opt<bool>LibOption1( ... ) // arg1 cl::ParseCommandLineOptions(argc, argv, "lib1\n"); }
.
// lib2 void main(int argc, const char **argv) { // need to reset arguments list here .. cl::opt<bool>LibOption2( ... ) // arg2 cl::ParseCommandLineOptions(argc, argv, "lib2\n"); // crash here! }
The application is associated with these two libs, and they perfectly parse the arguments if there is only 1 lib in the application and the argument parsing fails if the application has both libraries.
It seems that in the lines with the // arg argument some global static list (?) Of arguments has been added, and this makes them mixed lists of arguments and affects each other.
Is there any way to reset for this global list before declaring the arguments?
PS. I found a list of static arguments in CommandLine.cpp :
source share