On 2014-10-28 4:16 AM, Josip Maras wrote:
Hi Ehsan,

Yes, in my opinion that is the problem. I'm trying to use the global stream 
variable across module boundaries, more specifically from the following source 
files: content\base\src\Element.cpp; layout\style\nsCSSParser.cpp; 
content\base\src\nsINode.cpp, js\src\builtin\Eval.cpp, 
js\src\vm\Interpreter.cpp, js\src\jsfun.cpp, browser\app\nsBrowserApp.cpp, 
content\base\src\nsDocument.cpp, dom\base\nsGlobalWindow.cpp, 
parser\html\nsHtml5TreeOperation.cpp, 
content\html\document\src\nsHTMLContentSink.cpp

So it's across at least two different modules.

I've tried to follow your advice in using MOZ_EXPORT and MOZ_IMPORT, but I'm 
not getting anywhere :-/ The application runs, but it crashes.

Of the top of your head, do you maybe know of a variable that is used in a 
similar way, so that I can look into how this is supposed to be done.
For example, if I wanted to create a stream in nsBrowserApp.cpp and then use 
that stream from the other files what should I do?

Do I put:

extern MOZ_EXPORT std::stringstream FC_LOG_STREAM; in that file (or in the 
header included from that file, and then i define the varible in the .cpp file) 
and then use MOZ_IMPORT std::stringstream FC_LOG_STREAM; in the other 
files/headers or?

Sorry for taking up your time, but getting into the source code of Firefox, 
especially since I've done very little real world development in C++ is a bit 
overwhelming. Any help will be appreciated!

These macros just expand to __declspec(dllimport/dllexport), which is documented here: <http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx> Hopefully you can fix your problem following those instructions. Note that due to the nature of how we load xul.dll (which is done dynamically at runtime), I think your best bet is to export the variable from firefox.exe and import it in xul.dll, otherwise firefox.exe will not load because it will try to import a symbol from xul.dll but that DLL does not exist at startup time.

We export and import some functions in the code base, but I can't think of a place where we export variables off the top of my head. grepping for the above macros should lead you in the right direction.

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to