SWDEV-437702 - implement hipGetProcAddress

This should be used in place of dlsym or GetProcAddress (linux and windows respectively)

Change-Id: I5501b538e03892e8e5a2282678d848fcaf21d911
This commit is contained in:
jiabaxie
2023-12-15 18:19:58 -05:00
committed by Jiabao Xie
parent d6bc40e822
commit 0479cdb3dd
10 changed files with 238 additions and 18 deletions
+23
View File
@@ -958,4 +958,27 @@ bool PlatformState::CloseUniqueFileHandle(const std::shared_ptr<UniqueFD>& ufd)
}
return true;
}
void* PlatformState::getDynamicLibraryHandle() {
amd::ScopedLock lock(lock_);
if (dynamicLibraryHandle_ != nullptr) {
return dynamicLibraryHandle_;
}
#ifdef _WIN32
const char* libName = "amdhip64.dll";
#else
const char* libName = "libamdhip64.so";
#endif
dynamicLibraryHandle_ = amd::Os::loadLibrary(libName);
return dynamicLibraryHandle_;
}
void PlatformState::setDynamicLibraryHandle(void* handle){
amd::ScopedLock lock(lock_);
dynamicLibraryHandle_ = handle;
}
} //namespace hip