VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/components/xcDll.h@ 45791

最後變更 在這個檔案從45791是 1,由 vboxsync 提交於 55 年 前

import

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.6 KB
 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38/* Dll
39 *
40 * Programmatic representation of a dll. Stores modifiedTime and size for
41 * easy detection of change in dll.
42 *
43 * dp Suresh <[email protected]>
44 */
45
46#ifndef xcDll_h__
47#define xcDll_h__
48
49#include "prio.h"
50#include "prlink.h"
51#include "nsISupports.h"
52#include "nsILocalFile.h"
53#include "nsCOMPtr.h"
54#include "nsString.h"
55
56class nsNativeComponentLoader;
57
58#if defined(DEBUG) && !defined(XP_BEOS)
59#define SHOULD_IMPLEMENT_BREAKAFTERLOAD
60#endif
61
62class nsIModule;
63class nsIServiceManager;
64
65typedef enum nsDllStatus
66{
67 DLL_OK = 0,
68 DLL_NO_MEM = 1,
69 DLL_STAT_ERROR = 2,
70 DLL_NOT_FILE = 3,
71 DLL_INVALID_PARAM = 4
72} nsDllStatus;
73
74class nsDll
75{
76private:
77 nsCOMPtr<nsIFile> m_dllSpec;
78 PRLibrary *m_instance;
79 nsIModule *m_moduleObject;
80 nsNativeComponentLoader *m_loader;
81 PRBool m_markForUnload;
82
83 void Init(nsIFile *dllSpec);
84
85#ifdef SHOULD_IMPLEMENT_BREAKAFTERLOAD
86 void BreakAfterLoad(const char *nsprPath);
87#endif
88
89public:
90
91 nsDll(nsIFile *dllSpec, nsNativeComponentLoader* loader);
92 ~nsDll(void);
93
94 // Dll Loading
95 PRBool Load(void);
96 PRBool Unload(void);
97 PRBool IsLoaded(void)
98 {
99 return ((m_instance != 0) ? PR_TRUE : PR_FALSE);
100 }
101 void MarkForUnload(PRBool mark) { m_markForUnload = mark; }
102 PRBool IsMarkedForUnload(void) { return m_markForUnload; }
103
104 // Shutdown the dll. This will call any on unload hook for the dll.
105 // This wont unload the dll. Unload() implicitly calls Shutdown().
106 nsresult Shutdown(void);
107
108 void *FindSymbol(const char *symbol);
109
110 PRBool HasChanged(void);
111
112 void GetDisplayPath(nsACString& string);
113
114 PRLibrary *GetInstance(void) { return (m_instance); }
115
116 // NS_RELEASE() is required to be done on objects returned
117 nsresult GetDllSpec(nsIFile **dllSpec);
118 nsresult GetModule(nsISupports *servMgr, nsIModule **mobj);
119};
120
121#endif /* xcDll_h__ */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette