2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "DynamicDll.h"
11 #include "SectionLoader.h"
12 #include "utils/FileUtils.h"
13 #include "utils/log.h"
15 DllDynamic::DllDynamic()
21 DllDynamic::DllDynamic(const std::string
& strDllName
):
22 m_strDllName(strDllName
)
28 DllDynamic::~DllDynamic()
33 bool DllDynamic::Load()
38 if (!(m_dll
=CSectionLoader::LoadDLL(m_strDllName
, m_DelayUnload
, LoadSymbols())))
41 if (!ResolveExports())
43 CLog::Log(LOGERROR
, "Unable to resolve exports from dll {}", m_strDllName
);
51 void DllDynamic::Unload()
54 CSectionLoader::UnloadDLL(m_strDllName
);
58 bool DllDynamic::CanLoad()
60 return CFileUtils::Exists(m_strDllName
);
63 bool DllDynamic::EnableDelayedUnload(bool bOnOff
)
73 bool DllDynamic::SetFile(const std::string
& strDllName
)
78 m_strDllName
=strDllName
;