1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
---|
2 | /* |
---|
3 | * The contents of this file are subject to the Netscape Public License |
---|
4 | * Version 1.1 (the "NPL"); you may not use this file except in |
---|
5 | * compliance with the NPL. You may obtain a copy of the NPL at |
---|
6 | * http://www.mozilla.org/NPL/ |
---|
7 | * |
---|
8 | * Software distributed under the NPL is distributed on an "AS IS" basis, |
---|
9 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL |
---|
10 | * for the specific language governing rights and limitations under the |
---|
11 | * NPL. |
---|
12 | * |
---|
13 | * The Initial Developer of this code under the NPL is Netscape |
---|
14 | * Communications Corporation. Portions created by Netscape are |
---|
15 | * Copyright (C) 1999 Netscape Communications Corporation. All Rights |
---|
16 | * Reserved. |
---|
17 | */ |
---|
18 | |
---|
19 | #include "nsISupports.h" |
---|
20 | #include "nsIComponentLoader.h" |
---|
21 | #include "nsIComponentManager.h" |
---|
22 | #include "nsIFile.h" |
---|
23 | #include "nsDirectoryService.h" |
---|
24 | #include "nsCOMPtr.h" |
---|
25 | #include "nsHashtable.h" |
---|
26 | #include "nsVoidArray.h" |
---|
27 | #include "xcDll.h" |
---|
28 | #include "nsINativeComponentLoader.h" |
---|
29 | |
---|
30 | #ifndef nsNativeComponentLoader_h__ |
---|
31 | #define nsNativeComponentLoader_h__ |
---|
32 | |
---|
33 | class nsNativeComponentLoader : public nsIComponentLoader, public nsINativeComponentLoader { |
---|
34 | |
---|
35 | public: |
---|
36 | NS_DECL_ISUPPORTS |
---|
37 | NS_DECL_NSICOMPONENTLOADER |
---|
38 | NS_DECL_NSINATIVECOMPONENTLOADER |
---|
39 | |
---|
40 | nsNativeComponentLoader(); |
---|
41 | |
---|
42 | nsIComponentManager* mCompMgr; // weak reference -- backpointer |
---|
43 | nsHashtable mLoadedDependentLibs; |
---|
44 | |
---|
45 | private: |
---|
46 | nsObjectHashtable mDllStore; |
---|
47 | nsVoidArray mDeferredComponents; |
---|
48 | |
---|
49 | ~nsNativeComponentLoader() {} |
---|
50 | |
---|
51 | NS_IMETHOD RegisterComponentsInDir(PRInt32 when, nsIFile *dir); |
---|
52 | |
---|
53 | nsresult CreateDll(nsIFile *aSpec, const char *aLocation, nsDll **aDll); |
---|
54 | nsresult SelfRegisterDll(nsDll *dll, const char *registryLocation, |
---|
55 | PRBool deferred); |
---|
56 | nsresult SelfUnregisterDll(nsDll *dll); |
---|
57 | nsresult GetFactoryFromModule(nsDll *aDll, const nsCID &aCID, |
---|
58 | nsIFactory **aFactory); |
---|
59 | |
---|
60 | nsresult DumpLoadError(nsDll *dll, |
---|
61 | const char *aCallerName, |
---|
62 | const char *aNsprErrorMsg); |
---|
63 | }; |
---|
64 | |
---|
65 | |
---|
66 | // Exported Function from module dll to Create the nsIModule |
---|
67 | #define NS_GET_MODULE_SYMBOL "NSGetModule" |
---|
68 | |
---|
69 | extern "C" NS_EXPORT nsresult PR_CALLBACK |
---|
70 | NSGetModule(nsIComponentManager *aCompMgr, |
---|
71 | nsIFile* location, |
---|
72 | nsIModule** return_cobj); |
---|
73 | |
---|
74 | typedef nsresult (PR_CALLBACK *nsGetModuleProc)(nsIComponentManager *aCompMgr, |
---|
75 | nsIFile* location, |
---|
76 | nsIModule** return_cobj); |
---|
77 | |
---|
78 | |
---|
79 | #endif /* nsNativeComponentLoader_h__ */ |
---|
80 | |
---|