Hi, I'm extending the Firefox source in order to log some information during web app execution, for example event, script executions, new element creations, removals, attribute modifications, etc. Since these things occur often, when I load a more demanding application (e.g. facebook), everything hangs for a while, because there is a large number of relatively small pieces of information being written to a file.
Because of this, i was thinking of doing it in batches, having one global extern stream variable where all longs are added to, and when enough information gets accumulated to write it to a file, and avoid these hangings. Since I'm a noob C++ "programmer" I will paste some code of what i've done, just in case: I have one header file with the extern variable: -- FC_ExternStreamDeclaration.h -- #ifndef FC_EXTERN_VAR_DECL_H #define FC_EXTERN_VAR_DECL_H #include <stdio.h> #include <sstream> #include <fstream> extern std::stringstream FC_LOG_STREAM; #endif //FC_EXTERN_VAR_DECL_H and one header with the logging functionality -- FC_Log.h -- #pragma once #ifndef FC_LOG_H #define FC_LOG_H #include <stdio.h> #include <sstream> #include <fstream> #include "FC_ExternStreamDeclaration.h" inline void WriteToStream(const char** fragments, int length) { //add to stream //if stream big enough write to file } #endif //FC_LOG_H and in nsBrowserApp.cpp where the main function is defined, i define the variable and include the headers ----- nsBrowserApp.cpp --- #include "FC_ExternStreamDeclaration.h" #include "FC_Log.h" std::stringstream FC_LOG_STREAM; And then, in each file from which i do logging, i include the header files and call the WriteToStream function. For example, I'm doing it from Interpreter.cpp, Eval.cpp, nsINode.h, etc. (all over the code). And i thought that this will be enough. However, i get: error LNK2001 unresolved external symbol stringstream FC_LOG_STREAM. If i define it there, the compilation succeeds, but I effectively get two different streams, one for the JavaScript execution, and the other for the DOM and the rest of the browser. I'm thinking this happens because these variables are in different dlls. I would be grateful for any tips about fixing it. Sorry for the long question. Thank you, Josip _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform