@@ -33,26 +33,34 @@ namespace Diligent
3333
3434void DXCompilerLibrary::Load ()
3535{
36- if (!m_LibName.empty ())
37- m_Library = dlopen (m_LibName.c_str (), RTLD_LOCAL | RTLD_LAZY);
36+ #if defined(DILIGENT_USE_STATIC_DXC)
37+ m_Library = reinterpret_cast <void *>(0x1 );
38+ m_DxcCreateInstance = &DxcCreateInstance;
39+ #else
40+ if (!m_LibName.empty ())
41+ m_Library = dlopen (m_LibName.c_str (), RTLD_LOCAL | RTLD_LAZY);
3842
39- if (m_Library == nullptr )
40- m_Library = dlopen (" libdxcompiler.so" , RTLD_LOCAL | RTLD_LAZY);
43+ if (m_Library == nullptr )
44+ m_Library = dlopen (" libdxcompiler.so" , RTLD_LOCAL | RTLD_LAZY);
4145
42- // try to load from default path
43- if (m_Library == nullptr )
44- m_Library = dlopen (" /usr/lib/dxc/libdxcompiler.so" , RTLD_LOCAL | RTLD_LAZY);
46+ if (m_Library == nullptr )
47+ m_Library = dlopen (" /usr/lib/dxc/libdxcompiler.so" , RTLD_LOCAL | RTLD_LAZY);
4548
46- m_DxcCreateInstance = m_Library != nullptr ? reinterpret_cast <DxcCreateInstanceProc>(dlsym (m_Library, " DxcCreateInstance" )) : nullptr ;
49+ m_DxcCreateInstance = m_Library != nullptr
50+ ? reinterpret_cast <DxcCreateInstanceProc>(dlsym (m_Library, " DxcCreateInstance" ))
51+ : nullptr ;
52+ #endif
4753}
4854
4955void DXCompilerLibrary::Unload ()
5056{
51- if (m_Library != nullptr )
52- {
53- dlclose (m_Library);
54- m_Library = nullptr ;
55- }
57+ #if !defined(DILIGENT_USE_STATIC_DXC)
58+ if (m_Library != nullptr )
59+ {
60+ dlclose (m_Library);
61+ m_Library = nullptr ;
62+ }
63+ #endif
5664}
5765
5866} // namespace Diligent
0 commit comments