// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
#if !USE_AOT
using System.Linq.Expressions;
#endif
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using System.Runtime.CompilerServices;
using FlaxEngine.Assertions;
using System.Collections.Concurrent;
using System.IO;
using System.Text;
using System.Threading;
namespace FlaxEngine.Interop
{
///
/// Provides a Mono-like API for native code to access managed runtime.
///
[HideInEditor]
public static unsafe partial class NativeInterop
{
internal static Dictionary AssemblyLocations = new();
private static bool firstAssemblyLoaded = false;
private static Dictionary typeCache = new();
private static IntPtr boolTruePtr = ManagedHandle.ToIntPtr(ManagedHandle.Alloc((int)1, GCHandleType.Pinned));
private static IntPtr boolFalsePtr = ManagedHandle.ToIntPtr(ManagedHandle.Alloc((int)0, GCHandleType.Pinned));
private static List methodHandles = new();
private static ConcurrentDictionary cachedDelegates = new();
private static Dictionary managedTypes = new(new TypeComparer());
private static List fieldHandleCache = new();
#if FLAX_EDITOR
private static List methodHandlesCollectible = new();
private static ConcurrentDictionary cachedDelegatesCollectible = new();
private static Dictionary managedTypesCollectible = new(new TypeComparer());
private static List fieldHandleCacheCollectible = new();
#endif
private static Dictionary