コード例 #1
0
        private void Dispose(bool disposing)
        {
            // if not already disposed, dispose the module
            // Do this only on dispose. The containing context
            // will clean up the module when it is disposed or
            // finalized. Since finalization order isn't
            // deterministic it is possible that the module is
            // finalized after the context has already run its
            // finalizer, which would cause an access violation
            // in the native LLVM layer.
            if (disposing && ModuleHandle != default)
            {
                // remove the module handle from the module cache.
                Context.RemoveModule(this);

                // if this module was shared with a JIT, just release
                // the ref-count but don't dispose the actual module
                if (IsShared)
                {
                    SharedModuleRef.Close( );
                    SharedModuleRef = default;
                }
                else
                {
                    LLVMDisposeModule(ModuleHandle);
                }

                ModuleHandle = default;
            }
        }
コード例 #2
0
ファイル: OrcJit.cs プロジェクト: nbsn2/Llvm.NET
 private static extern LLVMOrcErrorCode LLVMOrcAddLazilyCompiledIR(LLVMOrcJITStackRef @JITStack, out LLVMOrcModuleHandle retHandle, LLVMSharedModuleRef @Mod, SymbolResolver @SymbolResolver, IntPtr @SymbolResolverCtx);