kodi
LibraryLoader.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <string>
12 
13 #ifdef TARGET_POSIX
14 #include "PlatformDefs.h"
15 #endif
16 
18 {
19 public:
20  explicit LibraryLoader(const std::string& libraryFile);
21  virtual ~LibraryLoader();
22 
23  virtual bool Load() = 0;
24  virtual void Unload() = 0;
25 
26  virtual int ResolveExport(const char* symbol, void** ptr, bool logging = true) = 0;
27  virtual int ResolveOrdinal(unsigned long ordinal, void** ptr);
28  virtual bool IsSystemDll() = 0;
29  virtual HMODULE GetHModule() = 0;
30  virtual bool HasSymbols() = 0;
31 
32  const char *GetName() const; // eg "mplayer.dll"
33  const char *GetFileName() const; // "special://xbmcbin/system/mplayer/players/mplayer.dll"
34  const char *GetPath() const; // "special://xbmcbin/system/mplayer/players/"
35 
36  int IncrRef();
37  int DecrRef();
38  int GetRef();
39 
40 private:
42  LibraryLoader& operator=(const LibraryLoader&);
43  std::string m_fileName;
44  std::string m_path;
45  int m_iRefCount;
46 };
Definition: LibraryLoader.h:17