I wonder if this will work on Mac.

John.

Jon Smirl wrote:
> 
> If I understand the way this was working, the interaction between the
> constructor and NS_EXPORT was causing the class definition to be
> instantiated in each module instead of just once for the app.  I made the
> constructor inline and removed NS_EXPORT from the class. I then made the
> only non-inline function, operator(),  NS_EXPORT. This gets rid of the
> exported symbols and the extra copies of the class.
> 
> This code definitely needs to go into the helper lib since the inline
> functions cause a tight linkage to the class definition.
> 
> If you like this fix and I can look for other similar ones. It's like that
> all of the do_XXX functions have this problem.
> 
> Index: mozilla/xpcom/base/nsIInterfaceRequestor.cpp
> ===================================================================
> RCS file: /cvsroot/mozilla/xpcom/base/nsIInterfaceRequestor.cpp,v
> retrieving revision 1.7
> diff -u -r1.7 nsIInterfaceRequestor.cpp
> --- mozilla/xpcom/base/nsIInterfaceRequestor.cpp 2001/09/28 20:12:24 1.7
> +++ mozilla/xpcom/base/nsIInterfaceRequestor.cpp 2001/10/11 01:10:20
> @@ -39,7 +39,7 @@
>  #include "nsIInterfaceRequestor.h"
>  #include "nsIInterfaceRequestorUtils.h"
> 
> -nsresult
> +nsresult NS_EXPORT
>  nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
>  {
>   nsresult status;
> @@ -62,3 +62,4 @@
>    *mErrorPtr = status;
>   return status;
>  }
> +
> Index: mozilla/xpcom/base/nsIInterfaceRequestorUtils.h
> ===================================================================
> RCS file: /cvsroot/mozilla/xpcom/base/nsIInterfaceRequestorUtils.h,v
> retrieving revision 3.2
> diff -u -r3.2 nsIInterfaceRequestorUtils.h
> --- mozilla/xpcom/base/nsIInterfaceRequestorUtils.h 2001/09/05 22:52:43 3.2
> +++ mozilla/xpcom/base/nsIInterfaceRequestorUtils.h 2001/10/11 01:10:20
> @@ -38,9 +38,10 @@
>                                   NS_REINTERPRET_CAST(void**,
> aDestination));
>    }
> 
> -class NS_EXPORT nsGetInterface : public nsCOMPtr_helper
> +class nsGetInterface : public nsCOMPtr_helper
>    {
>      public:
> +      inline
>        nsGetInterface( nsISupports* aSource, nsresult* error )
>            : mSource(aSource),
>              mErrorPtr(error)
> @@ -48,7 +49,7 @@
>            // nothing else to do here
>          }
> 
> -      virtual nsresult operator()( const nsIID&, void** ) const;
> +      virtual NS_EXPORT nsresult operator()( const nsIID&, void** ) const;
>        virtual ~nsGetInterface() {};
> 
>      private:
> 
> --
> Jon Smirl
> [EMAIL PROTECTED]

Reply via email to