Hi, 

Mike, Ehsan, and David, thank you!

In the end, I added the Logging functionality to mozglue, exported it, and 
imported it wherever necessary. Now it works as expected, and there are no 
noticeable hangings even when working with large applications (e.g. facebook). 

Just in case, if a beginner like me, runs into a similar problem, this link was 
also useful: http://msdn.microsoft.com/en-us/library/ms235636.aspx

Thank you,

Josip


On Wednesday, October 29, 2014 12:19:03 AM UTC+1, Mike Hommey wrote:
> On Wed, Oct 29, 2014 at 08:08:23AM +0900, Mike Hommey wrote:
> > On Tue, Oct 28, 2014 at 11:56:49AM -0400, Ehsan Akhgari wrote:
> > > 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.
> > 
> > It's not possible to use a symbol in an executable from a dll. Not
> > directly.
> 
> The best place for something that needs to be shared between firefox.exe
> and xul.dll is mozglue.dll. Both are linked against it.
> 
> Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to