2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "DynamicDll.h"
22 #include "SectionLoader.h"
23 #include "filesystem/File.h"
24 #include "utils/log.h"
26 using namespace XFILE
;
28 DllDynamic::DllDynamic()
34 DllDynamic::DllDynamic(const std::string
& strDllName
):
35 m_strDllName(strDllName
)
41 DllDynamic::~DllDynamic()
46 bool DllDynamic::Load()
51 if (!(m_dll
=CSectionLoader::LoadDLL(m_strDllName
, m_DelayUnload
, LoadSymbols())))
54 if (!ResolveExports())
56 CLog::Log(LOGERROR
, "Unable to resolve exports from dll %s", m_strDllName
.c_str());
64 void DllDynamic::Unload()
67 CSectionLoader::UnloadDLL(m_strDllName
);
71 bool DllDynamic::CanLoad()
73 return CFile::Exists(m_strDllName
);
76 bool DllDynamic::EnableDelayedUnload(bool bOnOff
)
86 bool DllDynamic::SetFile(const std::string
& strDllName
)
91 m_strDllName
=strDllName
;