summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-downstream-compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-07-18 15:44:29 -0400
committerGitHub <noreply@github.com>2022-07-18 15:44:29 -0400
commit2e4b5770fa7e6dbf56845382706b33a22d6a025b (patch)
treee58bcb7c446fcbffc8e1dd725636dbd737d946fc /source/compiler-core/slang-downstream-compiler.cpp
parentda8f050f9865635e5778589e1e3883b614d73266 (diff)
Atomic ref counting for ISlangSharedLibrary (#2332)
* #include an absolute path didn't work - because paths were taken to always be relative. * Make ISlangSharedLibrary atomic ref counted. Update docs to say most COM interfaces are *not* atomic ref counted. * Upgrade slang-llvm to use version that atomic ref counts ISlangSharedLibrary. * Fix some typos in docs. * Fix ref count typo. * Fix missing 'override'
Diffstat (limited to 'source/compiler-core/slang-downstream-compiler.cpp')
-rw-r--r--source/compiler-core/slang-downstream-compiler.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/compiler-core/slang-downstream-compiler.cpp b/source/compiler-core/slang-downstream-compiler.cpp
index 85726557e..2e30c23bc 100644
--- a/source/compiler-core/slang-downstream-compiler.cpp
+++ b/source/compiler-core/slang-downstream-compiler.cpp
@@ -360,11 +360,16 @@ SlangResult CommandLineDownstreamCompileResult::getHostCallableSharedLibrary(Com
{
return SLANG_FAIL;
}
- // The shared library needs to keep temp files in scope
- RefPtr<TemporarySharedLibrary> sharedLib(new TemporarySharedLibrary(handle, m_moduleFilePath));
- sharedLib->m_temporaryFileSet = m_temporaryFiles;
+
+ {
+ // The shared library needs to keep temp files in scope
+ auto temporarySharedLibrary = new TemporarySharedLibrary(handle, m_moduleFilePath);
+ // Make sure it gets a ref count
+ m_hostCallableSharedLibrary = temporarySharedLibrary;
+ // Set any additional info on the non COM pointer
+ temporarySharedLibrary->m_temporaryFileSet = m_temporaryFiles;
+ }
- m_hostCallableSharedLibrary = sharedLib;
outLibrary = m_hostCallableSharedLibrary;
return SLANG_OK;
}