diff options
| author | Yong He <yonghe@outlook.com> | 2022-08-10 01:58:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 01:58:41 -0700 |
| commit | 89083c4b50af8e48e70b25b63cc62aca21ab706c (patch) | |
| tree | 38e9544cd218dbeea0a2f26f267ac16f275c0291 /source/core/slang-platform.cpp | |
| parent | 9df7fcb023bd5a22f35ecd609b7a50cc6634976c (diff) | |
Language server pointer type support + add `DLLImport` test (#2350)
* Language server pointer type support.
+ Natvis for AST.
* Add completion suggestion for GUID.
* Make executable test able to use slang-rt.
* Fix gcc argument for rpath.
* Fix DLLImport on linux.
* Fix windows.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/core/slang-platform.cpp')
| -rw-r--r-- | source/core/slang-platform.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index 5185d5d23..921c85612 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -43,7 +43,7 @@ namespace Slang Path::combineIntoBuilder(parent.getUnownedSlice(), platformFileNameBuilder.getUnownedSlice(), outPath); } - else + else if (filename.getLength() > 0) { appendPlatformFileName(filename.getUnownedSlice(), outPath); } @@ -107,6 +107,13 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); /* static */SlangResult SharedLibrary::loadWithPlatformPath(char const* platformFileName, SharedLibrary::Handle& handleOut) { handleOut = nullptr; + if (!platformFileName || strlen(platformFileName) == 0) + { + if (!GetModuleHandleExA(0, nullptr, (HMODULE*)&handleOut)) + return SLANG_FAIL; + return SLANG_OK; + } + // https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibrarya const HMODULE h = LoadLibraryA(platformFileName); if (!h) @@ -170,10 +177,11 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); /* static */SlangResult SharedLibrary::loadWithPlatformPath(char const* platformFileName, Handle& handleOut) { handleOut = nullptr; - - void* h = dlopen(platformFileName, RTLD_NOW | RTLD_GLOBAL); - if(!h) - { + if (strlen(platformFileName) == 0) + platformFileName = nullptr; + void *h = dlopen(platformFileName, RTLD_NOW | RTLD_GLOBAL); + if (!h) + { #if 0 // We can't output the error message here, because it will cause output when testing what code gen is available if(auto msg = dlerror()) @@ -195,7 +203,6 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); /* static */void* SharedLibrary::findSymbolAddressByName(Handle handle, char const* name) { - SLANG_ASSERT(handle); return dlsym((void*)handle, name); } |
