diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-06-17 12:08:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-17 12:08:44 -0400 |
| commit | 0e052cfd8ecbb74204770ed872a701e64e75c38a (patch) | |
| tree | 4e5f1616e058b4bd0114d4544cf02b1428b81b37 /source/core | |
| parent | 1fe24d3a74a9cd51c4a025cd0e78642f3e29df79 (diff) | |
Fix shared library loading for testing. (#986)
* Fix shared library loading for testing.
* Improve comments.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-platform.h | 9 | ||||
| -rw-r--r-- | source/core/slang-render-api-util.cpp | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/source/core/slang-platform.h b/source/core/slang-platform.h index 31552e42b..c322d0568 100644 --- a/source/core/slang-platform.h +++ b/source/core/slang-platform.h @@ -15,7 +15,12 @@ namespace Slang typedef void(*FuncPtr)(void); - /// Load via an unadorned filename + /// Load via an unadorned filename. + /// + /// The unadorned filename here means without any platform specific filename elements. This typically means no extension and no prefix. + /// On windows this means without the '.dll' extension. + /// On linux this means without the 'lib' prefix and '.so' extension. + /// To load with a platform specific filename use the 'loadWithPlatformFilename' API /// /// @param the unadorned filename /// @return Returns a non null handle for the shared library on success. nullptr indicated failure @@ -42,7 +47,7 @@ namespace Slang /// The input name should be unadorned with any 'lib' prefix or extension static void appendPlatformFileName(const UnownedStringSlice& name, StringBuilder& dst); - /// Calculate the shared library + /// Given a path, calculate that path with the filename replaced with the platform filename (using appendPlatformFilename) static String calcPlatformPath(const UnownedStringSlice& path); private: diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp index 3df971219..d8bcaf396 100644 --- a/source/core/slang-render-api-util.cpp +++ b/source/core/slang-render-api-util.cpp @@ -262,10 +262,10 @@ static bool _canLoadSharedLibrary(const char* libName) #if SLANG_WINDOWS_FAMILY switch (type) { - case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32.dll"); - case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1.dll"); - case RenderApiType::D3D11: return _canLoadSharedLibrary("d3d11.dll"); - case RenderApiType::D3D12: return _canLoadSharedLibrary("d3d12.dll"); + case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32"); + case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1"); + case RenderApiType::D3D11: return _canLoadSharedLibrary("d3d11"); + case RenderApiType::D3D12: return _canLoadSharedLibrary("d3d12"); default: break; } #elif SLANG_UNIX_FAMILY |
