Created
May 8, 2015 09:13
-
-
Save HaiyongJiang/6d03f33854118853c4f9 to your computer and use it in GitHub Desktop.
load dependency dll ,add env path.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool LoadDependencyDLL(const std::string path) | |
{ | |
std::vector<std::string> filters; | |
filters.push_back("*.dll"); | |
filters.push_back("*.DLL"); | |
std::vector<std::string> fileList = getFileNameLists(path, filters, false, true); | |
for(int i=0; i<fileList.size(); i++) | |
{ | |
if(fileList[i].find(".dll") != -1) | |
{ | |
std::cout << "Load dynamic library: " << fileList[i] << "\n"; | |
::SetDllDirectory(path.c_str()); | |
::LoadLibraryA(fileList[i].c_str()); | |
} | |
} | |
return true; | |
} | |
bool AddENVPath(const std::string path) | |
{ | |
std::cout << "Add env: " << path << "\n"; | |
::_putenv(path.c_str()); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment