VirtualBox

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

Last change on this file since 103140 was 101944, checked in by vboxsync, 12 months ago

libs/xpcom: Convert xcDll.{cpp,h} and nsLocalFileUnix.cpp to use our RTLdr* API directly instead of going through the API defined in prlink.h (which is also just using RTLdr* internally), bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
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 <dp@netscape.com>
44 */
45
46#ifndef xcDll_h__
47#define xcDll_h__
48
49#include "nsISupports.h"
50#include "nsILocalFile.h"
51#include "nsCOMPtr.h"
52#include "nsString.h"
53
54#include <iprt/errcore.h>
55#include <iprt/ldr.h>
56
57class nsNativeComponentLoader;
58
59class nsIModule;
60class nsIServiceManager;
61
62typedef enum nsDllStatus
63{
64 DLL_OK = 0,
65 DLL_NO_MEM = 1,
66 DLL_STAT_ERROR = 2,
67 DLL_NOT_FILE = 3,
68 DLL_INVALID_PARAM = 4
69} nsDllStatus;
70
71class nsDll
72{
73private:
74 nsCOMPtr<nsIFile> m_dllSpec;
75 RTLDRMOD m_hMod;
76 nsIModule *m_moduleObject;
77 nsNativeComponentLoader *m_loader;
78 PRBool m_markForUnload;
79
80 void Init(nsIFile *dllSpec);
81
82public:
83
84 nsDll(nsIFile *dllSpec, nsNativeComponentLoader* loader);
85 ~nsDll(void);
86
87 // Dll Loading
88 PRBool Load(void);
89 PRBool Unload(void);
90 PRBool IsLoaded(void) { return ((m_hMod != NIL_RTLDRMOD) ? PR_TRUE : PR_FALSE); }
91
92 void MarkForUnload(PRBool mark) { m_markForUnload = mark; }
93 PRBool IsMarkedForUnload(void) { return m_markForUnload; }
94
95 // Shutdown the dll. This will call any on unload hook for the dll.
96 // This wont unload the dll. Unload() implicitly calls Shutdown().
97 nsresult Shutdown(void);
98
99 void *FindSymbol(const char *symbol);
100
101 PRBool HasChanged(void);
102
103 void GetDisplayPath(nsACString& string);
104
105#if 0
106 PRLibrary *GetInstance(void) { return (m_instance); }
107#endif
108
109 // NS_RELEASE() is required to be done on objects returned
110 nsresult GetDllSpec(nsIFile **dllSpec);
111 nsresult GetModule(nsISupports *servMgr, nsIModule **mobj);
112};
113
114#endif /* xcDll_h__ */
Note: See TracBrowser for help on using the repository browser.

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