VTB: release CVBuffer after it actually has been rendered
[xbmc.git] / xbmc / DynamicDll.cpp
blobf81c7d18bdadd04a62729ca814aec9c20c7642ce
1 /*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
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)
8 * any later version.
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()
30 m_dll=NULL;
31 m_DelayUnload=true;
34 DllDynamic::DllDynamic(const std::string& strDllName):
35 m_strDllName(strDllName)
37 m_dll=NULL;
38 m_DelayUnload=true;
41 DllDynamic::~DllDynamic()
43 Unload();
46 bool DllDynamic::Load()
48 if (m_dll)
49 return true;
51 if (!(m_dll=CSectionLoader::LoadDLL(m_strDllName, m_DelayUnload, LoadSymbols())))
52 return false;
54 if (!ResolveExports())
56 CLog::Log(LOGERROR, "Unable to resolve exports from dll %s", m_strDllName.c_str());
57 Unload();
58 return false;
61 return true;
64 void DllDynamic::Unload()
66 if(m_dll)
67 CSectionLoader::UnloadDLL(m_strDllName);
68 m_dll=NULL;
71 bool DllDynamic::CanLoad()
73 return CFile::Exists(m_strDllName);
76 bool DllDynamic::EnableDelayedUnload(bool bOnOff)
78 if (m_dll)
79 return false;
81 m_DelayUnload=bOnOff;
83 return true;
86 bool DllDynamic::SetFile(const std::string& strDllName)
88 if (m_dll)
89 return false;
91 m_strDllName=strDllName;
92 return true;