From add17b8f38992faae1b68ab531ff3605fcbfe7e2 Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Sat, 14 Sep 2002 17:12:46 +0000 Subject: [PATCH] XPCOM Glue Is broken on linux. b=168584, sr=alecf@netscape.com, r=bryner@netscape.com git-svn-id: svn://10.0.0.236/trunk@129615 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/build/nsXPComInit.cpp | 120 ++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 23 deletions(-) diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index a68fa832a80..c450ea2172e 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -629,29 +629,6 @@ NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine) return okay ? NS_OK : NS_ERROR_FAILURE; } -nsresult NS_COM -NS_GetFrozenFunctions(XPCOMFunctions *functions) -{ - if (!functions) - return NS_ERROR_OUT_OF_MEMORY; - - if (functions->version != XPCOM_GLUE_VERSION) - return NS_ERROR_FAILURE; - - functions->init = &NS_InitXPCOM2; - functions->shutdown = &NS_ShutdownXPCOM; - functions->getServiceManager = &NS_GetServiceManager; - functions->getComponentManager = &NS_GetComponentManager; - functions->getComponentRegistrar = &NS_GetComponentRegistrar; - functions->getMemoryManager = &NS_GetMemoryManager; - functions->newLocalFile = &NS_NewLocalFile; - functions->newNativeLocalFile = &NS_NewNativeLocalFile; - - functions->registerExitRoutine = &NS_RegisterXPCOMExitRoutine; - functions->unregisterExitRoutine = &NS_UnregisterXPCOMExitRoutine; - - return NS_OK; -} // // NS_ShutdownXPCOM() @@ -795,3 +772,100 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) +/* + Some symbol loaders use the address of the function defined in the + application, not the "real" function defined by xpcom. We need to return + the address of something in *this* library. Here, we create some stubs + and return them in NS_GetFrozenFunctions. +*/ + +static nsresult +internal_InitXPCOM2(nsIServiceManager* *result, + nsIFile* binDirectory, + nsIDirectoryServiceProvider* appFileLocationProvider) +{ + return NS_InitXPCOM2(result, binDirectory, appFileLocationProvider); +} + +static nsresult +internal_ShutdownXPCOM(nsIServiceManager* servMgr) +{ + return NS_ShutdownXPCOM(servMgr); +} + +static nsresult +internal_GetServiceManager(nsIServiceManager* *result) +{ + return NS_GetServiceManager(result); +} + +static nsresult +internal_GetComponentManager(nsIComponentManager* *result) +{ + return NS_GetComponentManager(result); +} + +static nsresult +internal_GetComponentRegistrar(nsIComponentRegistrar* *result) +{ + return NS_GetComponentRegistrar(result); +} + +static nsresult +internal_GetMemoryManager(nsIMemory* *result) +{ + return NS_GetMemoryManager(result); +} +static nsresult +internal_NewLocalFile(const nsAString &path, + PRBool followLinks, + nsILocalFile* *result) +{ + return NS_NewLocalFile(path, followLinks, result); +} + +static nsresult +internal_NewNativeLocalFile(const nsACString &path, + PRBool followLinks, + nsILocalFile* *result) +{ + return NS_NewNativeLocalFile(path, followLinks, result); +} + + +static nsresult +internal_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, + PRUint32 priority) +{ + return NS_RegisterXPCOMExitRoutine(exitRoutine, priority); +} + +nsresult NS_COM +internal_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine) +{ + return NS_UnregisterXPCOMExitRoutine(exitRoutine); +} + +nsresult NS_COM +NS_GetFrozenFunctions(XPCOMFunctions *functions) +{ + if (!functions) + return NS_ERROR_OUT_OF_MEMORY; + + if (functions->version != XPCOM_GLUE_VERSION) + return NS_ERROR_FAILURE; + + functions->init = &internal_InitXPCOM2; + functions->shutdown = &internal_ShutdownXPCOM; + functions->getServiceManager = &internal_GetServiceManager; + functions->getComponentManager = &internal_GetComponentManager; + functions->getComponentRegistrar = &internal_GetComponentRegistrar; + functions->getMemoryManager = &internal_GetMemoryManager; + functions->newLocalFile = &internal_NewLocalFile; + functions->newNativeLocalFile = &internal_NewNativeLocalFile; + + functions->registerExitRoutine = &internal_RegisterXPCOMExitRoutine; + functions->unregisterExitRoutine = &internal_UnregisterXPCOMExitRoutine; + + return NS_OK; +}