From 2e4b5770fa7e6dbf56845382706b33a22d6a025b Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 18 Jul 2022 15:44:29 -0400 Subject: 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' --- source/compiler-core/slang-downstream-compiler.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/compiler-core') 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 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; } -- cgit v1.2.3