Example #1
0
 internal static void Bind(NativeLibrary nativeLibrary)
 {
     Math.yepMath_Log_V64f_V64f = (yepMath_Log_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_Log_V64f_V64f", typeof(yepMath_Log_V64f_V64f_Delegate));
     Math.yepMath_Exp_V64f_V64f = (yepMath_Exp_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_Exp_V64f_V64f", typeof(yepMath_Exp_V64f_V64f_Delegate));
     Math.yepMath_Sin_V64f_V64f = (yepMath_Sin_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_Sin_V64f_V64f", typeof(yepMath_Sin_V64f_V64f_Delegate));
     Math.yepMath_Cos_V64f_V64f = (yepMath_Cos_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_Cos_V64f_V64f", typeof(yepMath_Cos_V64f_V64f_Delegate));
     Math.yepMath_Tan_V64f_V64f = (yepMath_Tan_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_Tan_V64f_V64f", typeof(yepMath_Tan_V64f_V64f_Delegate));
     Math.yepMath_EvaluatePolynomial_V32fV32f_V32f = (yepMath_EvaluatePolynomial_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepMath_EvaluatePolynomial_V32fV32f_V32f", typeof(yepMath_EvaluatePolynomial_V32fV32f_V32f_Delegate));
     Math.yepMath_EvaluatePolynomial_V64fV64f_V64f = (yepMath_EvaluatePolynomial_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepMath_EvaluatePolynomial_V64fV64f_V64f", typeof(yepMath_EvaluatePolynomial_V64fV64f_V64f_Delegate));
 }
Example #2
0
        public static void LoadNativeBackend(bool useCudaBackend)
        {
            bool ok = false;

            if (!nativeBackendLoaded)
            {
                Debug.WriteLine($"TorchSHarp: Initialising native backend");

                // See https://github.com/pytorch/pytorch/issues/33415
                if (useCudaBackend)
                {
                    ok = NativeLibrary.TryLoad("torch_cuda", typeof(Torch).Assembly, null, out var res1);
                }
                if (ok)
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        NativeLibrary.TryLoad("nvrtc-builtins64_102", typeof(Torch).Assembly, null, out var res2);
                        NativeLibrary.TryLoad("caffe2_nvrtc", typeof(Torch).Assembly, null, out var res3);
                        NativeLibrary.TryLoad("nvrtc64_102_0", typeof(Torch).Assembly, null, out var res4);
                    }
                }
                else
                {
                    ok = NativeLibrary.TryLoad("torch_cpu", typeof(Torch).Assembly, null, out var res2);
                }
                if (!ok)
                {
                    Console.WriteLine($"Native backend not found in application. Trying dynamic load for .NET/F# Interactive...");

                    // See https://github.com/xamarin/TorchSharp/issues/169
                    //
                    // If we are loading in .NET Interactive or F# Interactive, these are in packages in separate
                    // package directories. For managed DLLs this works OK, but native DLLs do not load transitive dependencies.
                    //
                    // So we shadow copy the DLLs to the TorchSharp package, make a copy of the native DLL and continue
                    //
                    // Assumed to be in ...\packages\torchsharp\0.3.0-local-debug-20200918\lib\netcoreapp3.1\TorchSharp.dll
                    var cpuRootPackage  = "libtorch-cpu";
                    var cudaRootPackage = $"libtorch-cuda-{cudaVersion}-{nativeRid}";
                    var torchsharpLoc   = Path.GetDirectoryName(typeof(Torch).Assembly.Location);
                    if (torchsharpLoc.Contains("torchsharp") && torchsharpLoc.Contains("lib"))
                    {
                        var packagesDir       = Path.GetFullPath(Path.Combine(torchsharpLoc, "..", "..", "..", ".."));
                        var torchSharpVersion = Path.GetFileName(Path.GetFullPath(Path.Combine(torchsharpLoc, "..", "..")));

                        if (useCudaBackend)
                        {
                            var cudaTarget = Path.Combine(torchsharpLoc, $"cuda -{cudaVersion}");
                            var cudaOk     = CopyNativeComponentsIntoSingleDirectory(packagesDir, $"{cudaRootPackage}-*", libtorchPackageVersion, cudaTarget);
                            if (cudaOk)
                            {
                                ok = CopyNativeComponentsIntoSingleDirectory(packagesDir, "torchsharp", torchSharpVersion, cudaTarget);
                                if (ok)
                                {
                                    ok = NativeLibrary.TryLoad(Path.Combine(cudaTarget, "LibTorchSharp.dll"), out var res3);
                                }
                            }
                            if (!ok)
                            {
                                throw new NotSupportedException($"The {cudaRootPackage} package version {libtorchPackageVersion} is not restored on this system. If using F# Interactive or .NET Interactive you may need to add a reference to this package, e.g. \n    #r \"nuget: {cudaRootPackage}, {libtorchPackageVersion}\"");
                            }
                        }
                        else
                        {
                            var cpuTarget = Path.Combine(torchsharpLoc, $"cpu");
                            var cpuOk     = CopyNativeComponentsIntoSingleDirectory(packagesDir, cpuRootPackage, libtorchPackageVersion, cpuTarget);
                            if (cpuOk)
                            {
                                ok = CopyNativeComponentsIntoSingleDirectory(packagesDir, "torchsharp", torchSharpVersion, cpuTarget);
                                if (ok)
                                {
                                    ok = NativeLibrary.TryLoad(Path.Combine(cpuTarget, "LibTorchSharp.dll"), out var res4);
                                }
                            }
                            if (!ok)
                            {
                                throw new NotSupportedException($"The {cpuRootPackage} package version {libtorchPackageVersion} is not restored on this system. If using F# Interactive or .NET Interactive you may need to add a reference to this package, e.g. \n    #r \"nuget: {cpuRootPackage}, {libtorchPackageVersion}\"");
                            }
                        }
                    }
                    else
                    {
                        throw new NotSupportedException($"This application uses TorchSharp but doesn't contain reference to either {cudaRootPackage} or {cpuRootPackage}, {libtorchPackageVersion}\"");
                    }
                }
                nativeBackendLoaded = ok;
            }
        }
Example #3
0
 public static NativeLibrary Load()
 {
     return(NativeLibrary.Load(LibraryFilename, LoadLibraryContent));
 }
        static int Main(string[] args)
        {
            // Disable running on Windows 7 until IJW activation work is complete.
            if (Environment.OSVersion.Platform != PlatformID.Win32NT || TestLibrary.Utilities.IsWindows7)
            {
                return(100);
            }

            try
            {
                // Load a fake mscoree.dll to avoid starting desktop
                IntPtr ijwHost = NativeLibrary.Load(Path.Combine(Environment.CurrentDirectory, "mscoree.dll"));

                WasModuleVTableQueriedDelegate wasModuleVTableQueried = Marshal.GetDelegateForFunctionPointer <WasModuleVTableQueriedDelegate>(NativeLibrary.GetExport(ijwHost, "WasModuleVTableQueried"));

                // Load IJW via reflection
                Assembly.Load("IjwNativeDll");

                IntPtr ijwModuleHandle = GetModuleHandle("IjwNativeDll.dll");

                Assert.AreNotEqual(IntPtr.Zero, ijwModuleHandle);
                Assert.IsTrue(wasModuleVTableQueried(ijwModuleHandle));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(101);
            }

            return(100);
        }
Example #5
0
 static PhysicsComponent()
 {
     // Preload proper libbulletc native library (depending on CPU type)
     NativeLibrary.PreloadLibrary("libbulletc.dll");
 }
Example #6
0
 private NativeLibrary(NativeLibrary.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
Example #7
0
 private NativeLibrary(NativeLibrary.Internal native, bool skipVTables = false)
     : this(__CopyValue(native), skipVTables)
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
Example #8
0
 internal NativeLibrary(NativeLibrary.Internal* native)
     : this(new global::System.IntPtr(native))
 {
 }
Example #9
0
        public override TaskOrResult <EffectBytecodeCompilerResult> Compile(ShaderMixinSource mixinTree, CompilerParameters compilerParameters)
        {
            var log = new LoggerResult();

            // Load D3D compiler dll
            // Note: No lock, it's probably fine if it gets called from multiple threads at the same time.
            if (Platform.IsWindowsDesktop && !d3dCompilerLoaded)
            {
                NativeLibrary.PreloadLibrary("d3dcompiler_47.dll");
                d3dCompilerLoaded = true;
            }

            var shaderMixinSource = mixinTree;
            var fullEffectName    = mixinTree.Name;
            var usedParameters    = mixinTree.UsedParameters;

            // Make a copy of shaderMixinSource. Use deep clone since shaderMixinSource can be altered during compilation (e.g. macros)
            var shaderMixinSourceCopy = new ShaderMixinSource();

            shaderMixinSourceCopy.DeepCloneFrom(shaderMixinSource);
            shaderMixinSource = shaderMixinSourceCopy;

            // Generate platform-specific macros
            var platform = usedParameters.Get(CompilerParameters.GraphicsPlatformKey);

            switch (platform)
            {
            case GraphicsPlatform.Direct3D11:
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D", 1);
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D11", 1);
                break;

            case GraphicsPlatform.OpenGL:
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL", 1);
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLCORE", 1);
                break;

            case GraphicsPlatform.OpenGLES:
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL", 1);
                shaderMixinSource.AddMacro("SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES", 1);
                break;

            default:
                throw new NotSupportedException();
            }

            var parsingResult = GetMixinParser().Parse(shaderMixinSource, shaderMixinSource.Macros.ToArray());

            // Copy log from parser results to output
            CopyLogs(parsingResult, log);

            // Return directly if there are any errors
            if (parsingResult.HasErrors)
            {
                return(new EffectBytecodeCompilerResult(null, log));
            }

            // Convert the AST to HLSL
            var writer = new SiliconStudio.Shaders.Writer.Hlsl.HlslWriter
            {
                EnablePreprocessorLine = true // Allow to output links to original pdxsl via #line pragmas
            };

            writer.Visit(parsingResult.Shader);
            var shaderSourceText = writer.Text;

            if (string.IsNullOrEmpty(shaderSourceText))
            {
                log.Error("No code generated for effect [{0}]", fullEffectName);
                return(new EffectBytecodeCompilerResult(null, log));
            }

            // -------------------------------------------------------
            // Save shader log
            // TODO: TEMP code to allow debugging generated shaders on Windows Desktop
#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            var shaderId = ObjectId.FromBytes(Encoding.UTF8.GetBytes(shaderSourceText));

            var logDir = "log";
            if (!Directory.Exists(logDir))
            {
                Directory.CreateDirectory(logDir);
            }
            var shaderSourceFilename = Path.Combine(logDir, "shader_" + fullEffectName.Replace('.', '_') + "_" + shaderId + ".hlsl");
            lock (WriterLock) // protect write in case the same shader is created twice
            {
                // Write shader before generating to make sure that we are having a trace before compiling it (compiler may crash...etc.)
                if (!File.Exists(shaderSourceFilename))
                {
                    File.WriteAllText(shaderSourceFilename, shaderSourceText);
                }
            }
#else
            string shaderSourceFilename = null;
#endif
            // -------------------------------------------------------

            var bytecode = new EffectBytecode {
                Reflection = parsingResult.Reflection, HashSources = parsingResult.HashSources
            };

            // Select the correct backend compiler
            IShaderCompiler compiler;
            switch (platform)
            {
#if SILICONSTUDIO_PLATFORM_WINDOWS
            case GraphicsPlatform.Direct3D11:
                compiler = new Direct3D.ShaderCompiler();
                break;
#endif
            case GraphicsPlatform.OpenGL:
            case GraphicsPlatform.OpenGLES:
                // get the number of render target outputs
                var rtOutputs = 0;
                var psOutput  = parsingResult.Shader.Declarations.OfType <StructType>().FirstOrDefault(x => x.Name.Text == "PS_OUTPUT");
                if (psOutput != null)
                {
                    foreach (var rto in psOutput.Fields)
                    {
                        var sem = rto.Qualifiers.OfType <Semantic>().FirstOrDefault();
                        if (sem != null)
                        {
                            // special case SV_Target
                            if (rtOutputs == 0 && sem.Name.Text == "SV_Target")
                            {
                                rtOutputs = 1;
                                break;
                            }
                            for (var i = rtOutputs; i < 8; ++i)
                            {
                                if (sem.Name.Text == ("SV_Target" + i))
                                {
                                    rtOutputs = i + 1;
                                    break;
                                }
                            }
                        }
                    }
                }
                compiler = new OpenGL.ShaderCompiler(rtOutputs);
                break;

            default:
                throw new NotSupportedException();
            }

            var shaderStageBytecodes = new List <ShaderBytecode>();

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            var stageStringBuilder = new StringBuilder();
#endif
            // if the shader (non-compute) does not have a pixel shader, we should add it on OpenGL ES.
            if (platform == GraphicsPlatform.OpenGLES && !parsingResult.EntryPoints.ContainsKey(ShaderStage.Pixel) && !parsingResult.EntryPoints.ContainsKey(ShaderStage.Compute))
            {
                parsingResult.EntryPoints.Add(ShaderStage.Pixel, null);
            }

            foreach (var stageBinding in parsingResult.EntryPoints)
            {
                // Compile
                // TODO: We could compile stages in different threads to improve compiler throughput?
                var result = compiler.Compile(shaderSourceText, stageBinding.Value, stageBinding.Key, usedParameters, bytecode.Reflection, shaderSourceFilename);
                result.CopyTo(log);

                if (result.HasErrors)
                {
                    continue;
                }

                // -------------------------------------------------------
                // Append bytecode id to shader log
#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
                stageStringBuilder.AppendLine("@G    {0} => {1}".ToFormat(stageBinding.Key, result.Bytecode.Id));
#endif
                // -------------------------------------------------------

                shaderStageBytecodes.Add(result.Bytecode);

                // When this is a compute shader, there is no need to scan other stages
                if (stageBinding.Key == ShaderStage.Compute)
                {
                    break;
                }
            }

            // In case of Direct3D, we can safely remove reflection data as it is entirely resolved at compile time.
            if (platform == GraphicsPlatform.Direct3D11)
            {
                CleanupReflection(bytecode.Reflection);
            }
            bytecode.Stages = shaderStageBytecodes.ToArray();

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            lock (WriterLock) // protect write in case the same shader is created twice
            {
                var builder = new StringBuilder();
                builder.AppendLine("/**************************");
                builder.AppendLine("***** Used Parameters *****");
                builder.AppendLine("***************************");
                builder.Append("@P EffectName: ");
                builder.AppendLine(fullEffectName ?? "");
                builder.Append(usedParameters.ToStringDetailed());
                builder.AppendLine("***************************");

                if (bytecode.Reflection.ConstantBuffers.Count > 0)
                {
                    builder.AppendLine("****  ConstantBuffers  ****");
                    builder.AppendLine("***************************");
                    foreach (var cBuffer in bytecode.Reflection.ConstantBuffers)
                    {
                        builder.AppendFormat("cbuffer {0} [Stage: {1}, Size: {2}]", cBuffer.Name, cBuffer.Stage, cBuffer.Size).AppendLine();
                        foreach (var parameter in cBuffer.Members)
                        {
                            builder.AppendFormat("@C    {0} => {1}", parameter.Param.RawName, parameter.Param.KeyName).AppendLine();
                        }
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.Reflection.ResourceBindings.Count > 0)
                {
                    builder.AppendLine("******  Resources    ******");
                    builder.AppendLine("***************************");
                    foreach (var resource in bytecode.Reflection.ResourceBindings)
                    {
                        var parameter = resource.Param;
                        builder.AppendFormat("@R    {0} => {1} [Stage: {2}, Slot: ({3}-{4})]", parameter.RawName, parameter.KeyName, resource.Stage, resource.SlotStart, resource.SlotStart + resource.SlotCount - 1).AppendLine();
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.HashSources.Count > 0)
                {
                    builder.AppendLine("*****     Sources     *****");
                    builder.AppendLine("***************************");
                    foreach (var hashSource in bytecode.HashSources)
                    {
                        builder.AppendFormat("@S    {0} => {1}", hashSource.Key, hashSource.Value).AppendLine();
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.Stages.Length > 0)
                {
                    builder.AppendLine("*****     Stages      *****");
                    builder.AppendLine("***************************");
                    builder.Append(stageStringBuilder);
                    builder.AppendLine("***************************");
                }
                builder.AppendLine("*************************/");

                // Re-append the shader with all informations
                builder.Append(shaderSourceText);

                File.WriteAllText(shaderSourceFilename, builder.ToString());
            }
#endif

            return(new EffectBytecodeCompilerResult(bytecode, log));
        }
Example #10
0
 // Static constructor to check for library availability.
 static TurboJpeg()
 {
     IsAvailable = NativeLibrary.TryLoad(LibraryName, typeof(TurboJpeg).Assembly, null, out _);
 }
Example #11
0
 static NativeInvoke()
 {
     NativeLibrary.PreloadLibrary(LibraryName, typeof(NativeInvoke));
 }
Example #12
0
 static OpenVR()
 {
     NativeLibrary.PreloadLibrary("openvr_api.dll", typeof(OpenVR));
 }
Example #13
0
    static void BlittableFunctionPointers()
    {
        Console.WriteLine($"Running {nameof(BlittableFunctionPointers)}...");

        IntPtr mod       = NativeLibrary.Load(NativeFunctions.GetFullPath());
        var    cbDefault = NativeLibrary.GetExport(mod, "DoubleInt").ToPointer();
        var    cbCdecl   = NativeLibrary.GetExport(mod, "DoubleIntCdecl").ToPointer();
        var    cbStdcall = NativeLibrary.GetExport(mod, "DoubleIntStdcall").ToPointer();

        const int a        = 7;
        const int expected = a * 2;

        {
            // No modopt
            Console.WriteLine($" -- unmanaged");
            int b = CallFunctionPointers.CallUnmanagedIntInt(cbDefault, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged cdecl");
            int b = CallFunctionPointers.CallUnmanagedCdeclIntInt(cbCdecl, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged stdcall");
            int b = CallFunctionPointers.CallUnmanagedStdcallIntInt(cbStdcall, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged modopt(cdecl)");
            int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptCdecl(cbCdecl, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged modopt(stdcall)");
            int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall(cbStdcall, a);
            Assert.Equal(expected, b);
        }

        {
            // Value in modopt is not a recognized calling convention
            Console.WriteLine($" -- unmanaged modopt unrecognized");
            int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptUnknown(cbDefault, a);
            Assert.Equal(expected, b);
        }

        {
            // Multiple modopts with calling conventions
            Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(cdecl)");
            var ex = Assert.Throws <InvalidProgramException>(
                () => CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall_ModOptCdecl(cbCdecl, a));
            Assert.Equal("Multiple unmanaged calling conventions are specified. Only a single calling convention is supported.", ex.Message);
        }

        {
            Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(unrecognized)");
            int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall_ModOptUnknown(cbStdcall, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged cdecl modopt(stdcall)");
            int b = CallFunctionPointers.CallUnmanagedCdeclIntInt_ModOptStdcall(cbCdecl, a);
            Assert.Equal(expected, b);
        }

        {
            Console.WriteLine($" -- unmanaged stdcall modopt(cdecl)");
            int b = CallFunctionPointers.CallUnmanagedStdcallIntInt_ModOptCdecl(cbStdcall, a);
            Assert.Equal(expected, b);
        }
    }
Example #14
0
 internal static void Bind(NativeLibrary nativeLibrary)
 {
     Core.yepCore_Add_V8sV8s_V8s = (yepCore_Add_V8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8sV8s_V8s", typeof(yepCore_Add_V8sV8s_V8s_Delegate));
     Core.yepCore_Add_V8sV8s_V16s = (yepCore_Add_V8sV8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8sV8s_V16s", typeof(yepCore_Add_V8sV8s_V16s_Delegate));
     Core.yepCore_Add_V8uV8u_V16u = (yepCore_Add_V8uV8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8uV8u_V16u", typeof(yepCore_Add_V8uV8u_V16u_Delegate));
     Core.yepCore_Add_V16sV16s_V16s = (yepCore_Add_V16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16sV16s_V16s", typeof(yepCore_Add_V16sV16s_V16s_Delegate));
     Core.yepCore_Add_V16sV16s_V32s = (yepCore_Add_V16sV16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16sV16s_V32s", typeof(yepCore_Add_V16sV16s_V32s_Delegate));
     Core.yepCore_Add_V16uV16u_V32u = (yepCore_Add_V16uV16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16uV16u_V32u", typeof(yepCore_Add_V16uV16u_V32u_Delegate));
     Core.yepCore_Add_V32sV32s_V32s = (yepCore_Add_V32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32sV32s_V32s", typeof(yepCore_Add_V32sV32s_V32s_Delegate));
     Core.yepCore_Add_V32sV32s_V64s = (yepCore_Add_V32sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32sV32s_V64s", typeof(yepCore_Add_V32sV32s_V64s_Delegate));
     Core.yepCore_Add_V32uV32u_V64u = (yepCore_Add_V32uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32uV32u_V64u", typeof(yepCore_Add_V32uV32u_V64u_Delegate));
     Core.yepCore_Add_V64sV64s_V64s = (yepCore_Add_V64sV64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V64sV64s_V64s", typeof(yepCore_Add_V64sV64s_V64s_Delegate));
     Core.yepCore_Add_V32fV32f_V32f = (yepCore_Add_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32fV32f_V32f", typeof(yepCore_Add_V32fV32f_V32f_Delegate));
     Core.yepCore_Add_V64fV64f_V64f = (yepCore_Add_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Add_V64fV64f_V64f", typeof(yepCore_Add_V64fV64f_V64f_Delegate));
     Core.yepCore_Add_V8sS8s_V8s = (yepCore_Add_V8sS8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8sS8s_V8s", typeof(yepCore_Add_V8sS8s_V8s_Delegate));
     Core.yepCore_Add_V8sS8s_V16s = (yepCore_Add_V8sS8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8sS8s_V16s", typeof(yepCore_Add_V8sS8s_V16s_Delegate));
     Core.yepCore_Add_V8uS8u_V16u = (yepCore_Add_V8uS8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V8uS8u_V16u", typeof(yepCore_Add_V8uS8u_V16u_Delegate));
     Core.yepCore_Add_V16sS16s_V16s = (yepCore_Add_V16sS16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16sS16s_V16s", typeof(yepCore_Add_V16sS16s_V16s_Delegate));
     Core.yepCore_Add_V16sS16s_V32s = (yepCore_Add_V16sS16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16sS16s_V32s", typeof(yepCore_Add_V16sS16s_V32s_Delegate));
     Core.yepCore_Add_V16uS16u_V32u = (yepCore_Add_V16uS16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V16uS16u_V32u", typeof(yepCore_Add_V16uS16u_V32u_Delegate));
     Core.yepCore_Add_V32sS32s_V32s = (yepCore_Add_V32sS32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32sS32s_V32s", typeof(yepCore_Add_V32sS32s_V32s_Delegate));
     Core.yepCore_Add_V32uS32u_V64u = (yepCore_Add_V32uS32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32uS32u_V64u", typeof(yepCore_Add_V32uS32u_V64u_Delegate));
     Core.yepCore_Add_V32sS32s_V64s = (yepCore_Add_V32sS32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32sS32s_V64s", typeof(yepCore_Add_V32sS32s_V64s_Delegate));
     Core.yepCore_Add_V64sS64s_V64s = (yepCore_Add_V64sS64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_V64sS64s_V64s", typeof(yepCore_Add_V64sS64s_V64s_Delegate));
     Core.yepCore_Add_V32fS32f_V32f = (yepCore_Add_V32fS32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Add_V32fS32f_V32f", typeof(yepCore_Add_V32fS32f_V32f_Delegate));
     Core.yepCore_Add_V64fS64f_V64f = (yepCore_Add_V64fS64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Add_V64fS64f_V64f", typeof(yepCore_Add_V64fS64f_V64f_Delegate));
     Core.yepCore_Add_IV8sV8s_IV8s = (yepCore_Add_IV8sV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV8sV8s_IV8s", typeof(yepCore_Add_IV8sV8s_IV8s_Delegate));
     Core.yepCore_Add_IV16sV16s_IV16s = (yepCore_Add_IV16sV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV16sV16s_IV16s", typeof(yepCore_Add_IV16sV16s_IV16s_Delegate));
     Core.yepCore_Add_IV32sV32s_IV32s = (yepCore_Add_IV32sV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV32sV32s_IV32s", typeof(yepCore_Add_IV32sV32s_IV32s_Delegate));
     Core.yepCore_Add_IV64sV64s_IV64s = (yepCore_Add_IV64sV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV64sV64s_IV64s", typeof(yepCore_Add_IV64sV64s_IV64s_Delegate));
     Core.yepCore_Add_IV32fV32f_IV32f = (yepCore_Add_IV32fV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV32fV32f_IV32f", typeof(yepCore_Add_IV32fV32f_IV32f_Delegate));
     Core.yepCore_Add_IV64fV64f_IV64f = (yepCore_Add_IV64fV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV64fV64f_IV64f", typeof(yepCore_Add_IV64fV64f_IV64f_Delegate));
     Core.yepCore_Add_IV8sS8s_IV8s = (yepCore_Add_IV8sS8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV8sS8s_IV8s", typeof(yepCore_Add_IV8sS8s_IV8s_Delegate));
     Core.yepCore_Add_IV16sS16s_IV16s = (yepCore_Add_IV16sS16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV16sS16s_IV16s", typeof(yepCore_Add_IV16sS16s_IV16s_Delegate));
     Core.yepCore_Add_IV32sS32s_IV32s = (yepCore_Add_IV32sS32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV32sS32s_IV32s", typeof(yepCore_Add_IV32sS32s_IV32s_Delegate));
     Core.yepCore_Add_IV64sS64s_IV64s = (yepCore_Add_IV64sS64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV64sS64s_IV64s", typeof(yepCore_Add_IV64sS64s_IV64s_Delegate));
     Core.yepCore_Add_IV32fS32f_IV32f = (yepCore_Add_IV32fS32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV32fS32f_IV32f", typeof(yepCore_Add_IV32fS32f_IV32f_Delegate));
     Core.yepCore_Add_IV64fS64f_IV64f = (yepCore_Add_IV64fS64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Add_IV64fS64f_IV64f", typeof(yepCore_Add_IV64fS64f_IV64f_Delegate));
     Core.yepCore_Subtract_V8sV8s_V8s = (yepCore_Subtract_V8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8sV8s_V8s", typeof(yepCore_Subtract_V8sV8s_V8s_Delegate));
     Core.yepCore_Subtract_V8sV8s_V16s = (yepCore_Subtract_V8sV8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8sV8s_V16s", typeof(yepCore_Subtract_V8sV8s_V16s_Delegate));
     Core.yepCore_Subtract_V8uV8u_V16u = (yepCore_Subtract_V8uV8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8uV8u_V16u", typeof(yepCore_Subtract_V8uV8u_V16u_Delegate));
     Core.yepCore_Subtract_V16sV16s_V16s = (yepCore_Subtract_V16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16sV16s_V16s", typeof(yepCore_Subtract_V16sV16s_V16s_Delegate));
     Core.yepCore_Subtract_V16sV16s_V32s = (yepCore_Subtract_V16sV16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16sV16s_V32s", typeof(yepCore_Subtract_V16sV16s_V32s_Delegate));
     Core.yepCore_Subtract_V16uV16u_V32u = (yepCore_Subtract_V16uV16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16uV16u_V32u", typeof(yepCore_Subtract_V16uV16u_V32u_Delegate));
     Core.yepCore_Subtract_V32sV32s_V32s = (yepCore_Subtract_V32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32sV32s_V32s", typeof(yepCore_Subtract_V32sV32s_V32s_Delegate));
     Core.yepCore_Subtract_V32sV32s_V64s = (yepCore_Subtract_V32sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32sV32s_V64s", typeof(yepCore_Subtract_V32sV32s_V64s_Delegate));
     Core.yepCore_Subtract_V32uV32u_V64u = (yepCore_Subtract_V32uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32uV32u_V64u", typeof(yepCore_Subtract_V32uV32u_V64u_Delegate));
     Core.yepCore_Subtract_V64sV64s_V64s = (yepCore_Subtract_V64sV64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64sV64s_V64s", typeof(yepCore_Subtract_V64sV64s_V64s_Delegate));
     Core.yepCore_Subtract_V32fV32f_V32f = (yepCore_Subtract_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32fV32f_V32f", typeof(yepCore_Subtract_V32fV32f_V32f_Delegate));
     Core.yepCore_Subtract_V64fV64f_V64f = (yepCore_Subtract_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64fV64f_V64f", typeof(yepCore_Subtract_V64fV64f_V64f_Delegate));
     Core.yepCore_Subtract_V8sS8s_V8s = (yepCore_Subtract_V8sS8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8sS8s_V8s", typeof(yepCore_Subtract_V8sS8s_V8s_Delegate));
     Core.yepCore_Subtract_V8sS8s_V16s = (yepCore_Subtract_V8sS8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8sS8s_V16s", typeof(yepCore_Subtract_V8sS8s_V16s_Delegate));
     Core.yepCore_Subtract_V8uS8u_V16u = (yepCore_Subtract_V8uS8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8uS8u_V16u", typeof(yepCore_Subtract_V8uS8u_V16u_Delegate));
     Core.yepCore_Subtract_V16sS16s_V16s = (yepCore_Subtract_V16sS16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16sS16s_V16s", typeof(yepCore_Subtract_V16sS16s_V16s_Delegate));
     Core.yepCore_Subtract_V16sS16s_V32s = (yepCore_Subtract_V16sS16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16sS16s_V32s", typeof(yepCore_Subtract_V16sS16s_V32s_Delegate));
     Core.yepCore_Subtract_V16uS16u_V32u = (yepCore_Subtract_V16uS16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16uS16u_V32u", typeof(yepCore_Subtract_V16uS16u_V32u_Delegate));
     Core.yepCore_Subtract_V32sS32s_V32s = (yepCore_Subtract_V32sS32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32sS32s_V32s", typeof(yepCore_Subtract_V32sS32s_V32s_Delegate));
     Core.yepCore_Subtract_V32sS32s_V64s = (yepCore_Subtract_V32sS32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32sS32s_V64s", typeof(yepCore_Subtract_V32sS32s_V64s_Delegate));
     Core.yepCore_Subtract_V32uS32u_V64u = (yepCore_Subtract_V32uS32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32uS32u_V64u", typeof(yepCore_Subtract_V32uS32u_V64u_Delegate));
     Core.yepCore_Subtract_V64sS64s_V64s = (yepCore_Subtract_V64sS64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64sS64s_V64s", typeof(yepCore_Subtract_V64sS64s_V64s_Delegate));
     Core.yepCore_Subtract_V32fS32f_V32f = (yepCore_Subtract_V32fS32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32fS32f_V32f", typeof(yepCore_Subtract_V32fS32f_V32f_Delegate));
     Core.yepCore_Subtract_V64fS64f_V64f = (yepCore_Subtract_V64fS64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64fS64f_V64f", typeof(yepCore_Subtract_V64fS64f_V64f_Delegate));
     Core.yepCore_Subtract_S8sV8s_V8s = (yepCore_Subtract_S8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S8sV8s_V8s", typeof(yepCore_Subtract_S8sV8s_V8s_Delegate));
     Core.yepCore_Subtract_S8sV8s_V16s = (yepCore_Subtract_S8sV8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S8sV8s_V16s", typeof(yepCore_Subtract_S8sV8s_V16s_Delegate));
     Core.yepCore_Subtract_S8uV8u_V16u = (yepCore_Subtract_S8uV8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S8uV8u_V16u", typeof(yepCore_Subtract_S8uV8u_V16u_Delegate));
     Core.yepCore_Subtract_S16sV16s_V16s = (yepCore_Subtract_S16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S16sV16s_V16s", typeof(yepCore_Subtract_S16sV16s_V16s_Delegate));
     Core.yepCore_Subtract_S16sV16s_V32s = (yepCore_Subtract_S16sV16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S16sV16s_V32s", typeof(yepCore_Subtract_S16sV16s_V32s_Delegate));
     Core.yepCore_Subtract_S16uV16u_V32u = (yepCore_Subtract_S16uV16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S16uV16u_V32u", typeof(yepCore_Subtract_S16uV16u_V32u_Delegate));
     Core.yepCore_Subtract_S32sV32s_V32s = (yepCore_Subtract_S32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32sV32s_V32s", typeof(yepCore_Subtract_S32sV32s_V32s_Delegate));
     Core.yepCore_Subtract_S32sV32s_V64s = (yepCore_Subtract_S32sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32sV32s_V64s", typeof(yepCore_Subtract_S32sV32s_V64s_Delegate));
     Core.yepCore_Subtract_S32uV32u_V64u = (yepCore_Subtract_S32uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32uV32u_V64u", typeof(yepCore_Subtract_S32uV32u_V64u_Delegate));
     Core.yepCore_Subtract_S64sV64s_V64s = (yepCore_Subtract_S64sV64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S64sV64s_V64s", typeof(yepCore_Subtract_S64sV64s_V64s_Delegate));
     Core.yepCore_Subtract_S32fV32f_V32f = (yepCore_Subtract_S32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32fV32f_V32f", typeof(yepCore_Subtract_S32fV32f_V32f_Delegate));
     Core.yepCore_Subtract_S64fV64f_V64f = (yepCore_Subtract_S64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S64fV64f_V64f", typeof(yepCore_Subtract_S64fV64f_V64f_Delegate));
     Core.yepCore_Subtract_IV8sV8s_IV8s = (yepCore_Subtract_IV8sV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV8sV8s_IV8s", typeof(yepCore_Subtract_IV8sV8s_IV8s_Delegate));
     Core.yepCore_Subtract_IV16sV16s_IV16s = (yepCore_Subtract_IV16sV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV16sV16s_IV16s", typeof(yepCore_Subtract_IV16sV16s_IV16s_Delegate));
     Core.yepCore_Subtract_IV32sV32s_IV32s = (yepCore_Subtract_IV32sV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV32sV32s_IV32s", typeof(yepCore_Subtract_IV32sV32s_IV32s_Delegate));
     Core.yepCore_Subtract_IV64sV64s_IV64s = (yepCore_Subtract_IV64sV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV64sV64s_IV64s", typeof(yepCore_Subtract_IV64sV64s_IV64s_Delegate));
     Core.yepCore_Subtract_IV32fV32f_IV32f = (yepCore_Subtract_IV32fV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV32fV32f_IV32f", typeof(yepCore_Subtract_IV32fV32f_IV32f_Delegate));
     Core.yepCore_Subtract_IV64fV64f_IV64f = (yepCore_Subtract_IV64fV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV64fV64f_IV64f", typeof(yepCore_Subtract_IV64fV64f_IV64f_Delegate));
     Core.yepCore_Subtract_V8sIV8s_IV8s = (yepCore_Subtract_V8sIV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V8sIV8s_IV8s", typeof(yepCore_Subtract_V8sIV8s_IV8s_Delegate));
     Core.yepCore_Subtract_V16sIV16s_IV16s = (yepCore_Subtract_V16sIV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V16sIV16s_IV16s", typeof(yepCore_Subtract_V16sIV16s_IV16s_Delegate));
     Core.yepCore_Subtract_V32sIV32s_IV32s = (yepCore_Subtract_V32sIV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32sIV32s_IV32s", typeof(yepCore_Subtract_V32sIV32s_IV32s_Delegate));
     Core.yepCore_Subtract_V64sIV64s_IV64s = (yepCore_Subtract_V64sIV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64sIV64s_IV64s", typeof(yepCore_Subtract_V64sIV64s_IV64s_Delegate));
     Core.yepCore_Subtract_V32fIV32f_IV32f = (yepCore_Subtract_V32fIV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V32fIV32f_IV32f", typeof(yepCore_Subtract_V32fIV32f_IV32f_Delegate));
     Core.yepCore_Subtract_V64fIV64f_IV64f = (yepCore_Subtract_V64fIV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_V64fIV64f_IV64f", typeof(yepCore_Subtract_V64fIV64f_IV64f_Delegate));
     Core.yepCore_Subtract_IV8sS8s_IV8s = (yepCore_Subtract_IV8sS8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV8sS8s_IV8s", typeof(yepCore_Subtract_IV8sS8s_IV8s_Delegate));
     Core.yepCore_Subtract_IV16sS16s_IV16s = (yepCore_Subtract_IV16sS16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV16sS16s_IV16s", typeof(yepCore_Subtract_IV16sS16s_IV16s_Delegate));
     Core.yepCore_Subtract_IV32sS32s_IV32s = (yepCore_Subtract_IV32sS32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV32sS32s_IV32s", typeof(yepCore_Subtract_IV32sS32s_IV32s_Delegate));
     Core.yepCore_Subtract_IV64sS64s_IV64s = (yepCore_Subtract_IV64sS64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV64sS64s_IV64s", typeof(yepCore_Subtract_IV64sS64s_IV64s_Delegate));
     Core.yepCore_Subtract_IV32fS32f_IV32f = (yepCore_Subtract_IV32fS32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV32fS32f_IV32f", typeof(yepCore_Subtract_IV32fS32f_IV32f_Delegate));
     Core.yepCore_Subtract_IV64fS64f_IV64f = (yepCore_Subtract_IV64fS64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_IV64fS64f_IV64f", typeof(yepCore_Subtract_IV64fS64f_IV64f_Delegate));
     Core.yepCore_Subtract_S8sIV8s_IV8s = (yepCore_Subtract_S8sIV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S8sIV8s_IV8s", typeof(yepCore_Subtract_S8sIV8s_IV8s_Delegate));
     Core.yepCore_Subtract_S16sIV16s_IV16s = (yepCore_Subtract_S16sIV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S16sIV16s_IV16s", typeof(yepCore_Subtract_S16sIV16s_IV16s_Delegate));
     Core.yepCore_Subtract_S32sIV32s_IV32s = (yepCore_Subtract_S32sIV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32sIV32s_IV32s", typeof(yepCore_Subtract_S32sIV32s_IV32s_Delegate));
     Core.yepCore_Subtract_S64sIV64s_IV64s = (yepCore_Subtract_S64sIV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S64sIV64s_IV64s", typeof(yepCore_Subtract_S64sIV64s_IV64s_Delegate));
     Core.yepCore_Subtract_S32fIV32f_IV32f = (yepCore_Subtract_S32fIV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S32fIV32f_IV32f", typeof(yepCore_Subtract_S32fIV32f_IV32f_Delegate));
     Core.yepCore_Subtract_S64fIV64f_IV64f = (yepCore_Subtract_S64fIV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Subtract_S64fIV64f_IV64f", typeof(yepCore_Subtract_S64fIV64f_IV64f_Delegate));
     Core.yepCore_Negate_V8s_V8s = (yepCore_Negate_V8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V8s_V8s", typeof(yepCore_Negate_V8s_V8s_Delegate));
     Core.yepCore_Negate_V16s_V16s = (yepCore_Negate_V16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V16s_V16s", typeof(yepCore_Negate_V16s_V16s_Delegate));
     Core.yepCore_Negate_V32s_V32s = (yepCore_Negate_V32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V32s_V32s", typeof(yepCore_Negate_V32s_V32s_Delegate));
     Core.yepCore_Negate_V64s_V64s = (yepCore_Negate_V64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V64s_V64s", typeof(yepCore_Negate_V64s_V64s_Delegate));
     Core.yepCore_Negate_V32f_V32f = (yepCore_Negate_V32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V32f_V32f", typeof(yepCore_Negate_V32f_V32f_Delegate));
     Core.yepCore_Negate_V64f_V64f = (yepCore_Negate_V64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Negate_V64f_V64f", typeof(yepCore_Negate_V64f_V64f_Delegate));
     Core.yepCore_Negate_IV8s_IV8s = (yepCore_Negate_IV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV8s_IV8s", typeof(yepCore_Negate_IV8s_IV8s_Delegate));
     Core.yepCore_Negate_IV16s_IV16s = (yepCore_Negate_IV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV16s_IV16s", typeof(yepCore_Negate_IV16s_IV16s_Delegate));
     Core.yepCore_Negate_IV32s_IV32s = (yepCore_Negate_IV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV32s_IV32s", typeof(yepCore_Negate_IV32s_IV32s_Delegate));
     Core.yepCore_Negate_IV64s_IV64s = (yepCore_Negate_IV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV64s_IV64s", typeof(yepCore_Negate_IV64s_IV64s_Delegate));
     Core.yepCore_Negate_IV32f_IV32f = (yepCore_Negate_IV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV32f_IV32f", typeof(yepCore_Negate_IV32f_IV32f_Delegate));
     Core.yepCore_Negate_IV64f_IV64f = (yepCore_Negate_IV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Negate_IV64f_IV64f", typeof(yepCore_Negate_IV64f_IV64f_Delegate));
     Core.yepCore_Multiply_V8sV8s_V8s = (yepCore_Multiply_V8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8sV8s_V8s", typeof(yepCore_Multiply_V8sV8s_V8s_Delegate));
     Core.yepCore_Multiply_V8sV8s_V16s = (yepCore_Multiply_V8sV8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8sV8s_V16s", typeof(yepCore_Multiply_V8sV8s_V16s_Delegate));
     Core.yepCore_Multiply_V8uV8u_V16u = (yepCore_Multiply_V8uV8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8uV8u_V16u", typeof(yepCore_Multiply_V8uV8u_V16u_Delegate));
     Core.yepCore_Multiply_V16sV16s_V16s = (yepCore_Multiply_V16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16sV16s_V16s", typeof(yepCore_Multiply_V16sV16s_V16s_Delegate));
     Core.yepCore_Multiply_V16sV16s_V32s = (yepCore_Multiply_V16sV16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16sV16s_V32s", typeof(yepCore_Multiply_V16sV16s_V32s_Delegate));
     Core.yepCore_Multiply_V16uV16u_V32u = (yepCore_Multiply_V16uV16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16uV16u_V32u", typeof(yepCore_Multiply_V16uV16u_V32u_Delegate));
     Core.yepCore_Multiply_V32sV32s_V32s = (yepCore_Multiply_V32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32sV32s_V32s", typeof(yepCore_Multiply_V32sV32s_V32s_Delegate));
     Core.yepCore_Multiply_V32sV32s_V64s = (yepCore_Multiply_V32sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32sV32s_V64s", typeof(yepCore_Multiply_V32sV32s_V64s_Delegate));
     Core.yepCore_Multiply_V32uV32u_V64u = (yepCore_Multiply_V32uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32uV32u_V64u", typeof(yepCore_Multiply_V32uV32u_V64u_Delegate));
     Core.yepCore_Multiply_V64sV64s_V64s = (yepCore_Multiply_V64sV64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V64sV64s_V64s", typeof(yepCore_Multiply_V64sV64s_V64s_Delegate));
     Core.yepCore_Multiply_V32fV32f_V32f = (yepCore_Multiply_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32fV32f_V32f", typeof(yepCore_Multiply_V32fV32f_V32f_Delegate));
     Core.yepCore_Multiply_V64fV64f_V64f = (yepCore_Multiply_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V64fV64f_V64f", typeof(yepCore_Multiply_V64fV64f_V64f_Delegate));
     Core.yepCore_Multiply_V8sS8s_V8s = (yepCore_Multiply_V8sS8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8sS8s_V8s", typeof(yepCore_Multiply_V8sS8s_V8s_Delegate));
     Core.yepCore_Multiply_V8sS8s_V16s = (yepCore_Multiply_V8sS8s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8sS8s_V16s", typeof(yepCore_Multiply_V8sS8s_V16s_Delegate));
     Core.yepCore_Multiply_V8uS8u_V16u = (yepCore_Multiply_V8uS8u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V8uS8u_V16u", typeof(yepCore_Multiply_V8uS8u_V16u_Delegate));
     Core.yepCore_Multiply_V16sS16s_V16s = (yepCore_Multiply_V16sS16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16sS16s_V16s", typeof(yepCore_Multiply_V16sS16s_V16s_Delegate));
     Core.yepCore_Multiply_V16sS16s_V32s = (yepCore_Multiply_V16sS16s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16sS16s_V32s", typeof(yepCore_Multiply_V16sS16s_V32s_Delegate));
     Core.yepCore_Multiply_V16uS16u_V32u = (yepCore_Multiply_V16uS16u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V16uS16u_V32u", typeof(yepCore_Multiply_V16uS16u_V32u_Delegate));
     Core.yepCore_Multiply_V32sS32s_V32s = (yepCore_Multiply_V32sS32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32sS32s_V32s", typeof(yepCore_Multiply_V32sS32s_V32s_Delegate));
     Core.yepCore_Multiply_V32sS32s_V64s = (yepCore_Multiply_V32sS32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32sS32s_V64s", typeof(yepCore_Multiply_V32sS32s_V64s_Delegate));
     Core.yepCore_Multiply_V32uS32u_V64u = (yepCore_Multiply_V32uS32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32uS32u_V64u", typeof(yepCore_Multiply_V32uS32u_V64u_Delegate));
     Core.yepCore_Multiply_V64sS64s_V64s = (yepCore_Multiply_V64sS64s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V64sS64s_V64s", typeof(yepCore_Multiply_V64sS64s_V64s_Delegate));
     Core.yepCore_Multiply_V32fS32f_V32f = (yepCore_Multiply_V32fS32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V32fS32f_V32f", typeof(yepCore_Multiply_V32fS32f_V32f_Delegate));
     Core.yepCore_Multiply_V64fS64f_V64f = (yepCore_Multiply_V64fS64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_V64fS64f_V64f", typeof(yepCore_Multiply_V64fS64f_V64f_Delegate));
     Core.yepCore_Multiply_IV8sV8s_IV8s = (yepCore_Multiply_IV8sV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV8sV8s_IV8s", typeof(yepCore_Multiply_IV8sV8s_IV8s_Delegate));
     Core.yepCore_Multiply_IV16sV16s_IV16s = (yepCore_Multiply_IV16sV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV16sV16s_IV16s", typeof(yepCore_Multiply_IV16sV16s_IV16s_Delegate));
     Core.yepCore_Multiply_IV32sV32s_IV32s = (yepCore_Multiply_IV32sV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV32sV32s_IV32s", typeof(yepCore_Multiply_IV32sV32s_IV32s_Delegate));
     Core.yepCore_Multiply_IV64sV64s_IV64s = (yepCore_Multiply_IV64sV64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV64sV64s_IV64s", typeof(yepCore_Multiply_IV64sV64s_IV64s_Delegate));
     Core.yepCore_Multiply_IV32fV32f_IV32f = (yepCore_Multiply_IV32fV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV32fV32f_IV32f", typeof(yepCore_Multiply_IV32fV32f_IV32f_Delegate));
     Core.yepCore_Multiply_IV64fV64f_IV64f = (yepCore_Multiply_IV64fV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV64fV64f_IV64f", typeof(yepCore_Multiply_IV64fV64f_IV64f_Delegate));
     Core.yepCore_Multiply_IV8sS8s_IV8s = (yepCore_Multiply_IV8sS8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV8sS8s_IV8s", typeof(yepCore_Multiply_IV8sS8s_IV8s_Delegate));
     Core.yepCore_Multiply_IV16sS16s_IV16s = (yepCore_Multiply_IV16sS16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV16sS16s_IV16s", typeof(yepCore_Multiply_IV16sS16s_IV16s_Delegate));
     Core.yepCore_Multiply_IV32sS32s_IV32s = (yepCore_Multiply_IV32sS32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV32sS32s_IV32s", typeof(yepCore_Multiply_IV32sS32s_IV32s_Delegate));
     Core.yepCore_Multiply_IV64sS64s_IV64s = (yepCore_Multiply_IV64sS64s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV64sS64s_IV64s", typeof(yepCore_Multiply_IV64sS64s_IV64s_Delegate));
     Core.yepCore_Multiply_IV32fS32f_IV32f = (yepCore_Multiply_IV32fS32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV32fS32f_IV32f", typeof(yepCore_Multiply_IV32fS32f_IV32f_Delegate));
     Core.yepCore_Multiply_IV64fS64f_IV64f = (yepCore_Multiply_IV64fS64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Multiply_IV64fS64f_IV64f", typeof(yepCore_Multiply_IV64fS64f_IV64f_Delegate));
     Core.yepCore_Min_V8s_S8s = (yepCore_Min_V8s_S8s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8s_S8s", typeof(yepCore_Min_V8s_S8s_Delegate));
     Core.yepCore_Min_V8u_S8u = (yepCore_Min_V8u_S8u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8u_S8u", typeof(yepCore_Min_V8u_S8u_Delegate));
     Core.yepCore_Min_V16s_S16s = (yepCore_Min_V16s_S16s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16s_S16s", typeof(yepCore_Min_V16s_S16s_Delegate));
     Core.yepCore_Min_V16u_S16u = (yepCore_Min_V16u_S16u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16u_S16u", typeof(yepCore_Min_V16u_S16u_Delegate));
     Core.yepCore_Min_V32s_S32s = (yepCore_Min_V32s_S32s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32s_S32s", typeof(yepCore_Min_V32s_S32s_Delegate));
     Core.yepCore_Min_V32u_S32u = (yepCore_Min_V32u_S32u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32u_S32u", typeof(yepCore_Min_V32u_S32u_Delegate));
     Core.yepCore_Min_V64s_S64s = (yepCore_Min_V64s_S64s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64s_S64s", typeof(yepCore_Min_V64s_S64s_Delegate));
     Core.yepCore_Min_V64u_S64u = (yepCore_Min_V64u_S64u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64u_S64u", typeof(yepCore_Min_V64u_S64u_Delegate));
     Core.yepCore_Min_V32f_S32f = (yepCore_Min_V32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32f_S32f", typeof(yepCore_Min_V32f_S32f_Delegate));
     Core.yepCore_Min_V64f_S64f = (yepCore_Min_V64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64f_S64f", typeof(yepCore_Min_V64f_S64f_Delegate));
     Core.yepCore_Min_V8sV8s_V8s = (yepCore_Min_V8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8sV8s_V8s", typeof(yepCore_Min_V8sV8s_V8s_Delegate));
     Core.yepCore_Min_V8uV8u_V8u = (yepCore_Min_V8uV8u_V8u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8uV8u_V8u", typeof(yepCore_Min_V8uV8u_V8u_Delegate));
     Core.yepCore_Min_V16sV16s_V16s = (yepCore_Min_V16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16sV16s_V16s", typeof(yepCore_Min_V16sV16s_V16s_Delegate));
     Core.yepCore_Min_V16uV16u_V16u = (yepCore_Min_V16uV16u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16uV16u_V16u", typeof(yepCore_Min_V16uV16u_V16u_Delegate));
     Core.yepCore_Min_V32sV32s_V32s = (yepCore_Min_V32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32sV32s_V32s", typeof(yepCore_Min_V32sV32s_V32s_Delegate));
     Core.yepCore_Min_V32uV32u_V32u = (yepCore_Min_V32uV32u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32uV32u_V32u", typeof(yepCore_Min_V32uV32u_V32u_Delegate));
     Core.yepCore_Min_V64sV32s_V64s = (yepCore_Min_V64sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64sV32s_V64s", typeof(yepCore_Min_V64sV32s_V64s_Delegate));
     Core.yepCore_Min_V64uV32u_V64u = (yepCore_Min_V64uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64uV32u_V64u", typeof(yepCore_Min_V64uV32u_V64u_Delegate));
     Core.yepCore_Min_V32fV32f_V32f = (yepCore_Min_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32fV32f_V32f", typeof(yepCore_Min_V32fV32f_V32f_Delegate));
     Core.yepCore_Min_V64fV64f_V64f = (yepCore_Min_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64fV64f_V64f", typeof(yepCore_Min_V64fV64f_V64f_Delegate));
     Core.yepCore_Min_V8sS8s_V8s = (yepCore_Min_V8sS8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8sS8s_V8s", typeof(yepCore_Min_V8sS8s_V8s_Delegate));
     Core.yepCore_Min_V8uS8u_V8u = (yepCore_Min_V8uS8u_V8u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V8uS8u_V8u", typeof(yepCore_Min_V8uS8u_V8u_Delegate));
     Core.yepCore_Min_V16sS16s_V16s = (yepCore_Min_V16sS16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16sS16s_V16s", typeof(yepCore_Min_V16sS16s_V16s_Delegate));
     Core.yepCore_Min_V16uS16u_V16u = (yepCore_Min_V16uS16u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V16uS16u_V16u", typeof(yepCore_Min_V16uS16u_V16u_Delegate));
     Core.yepCore_Min_V32sS32s_V32s = (yepCore_Min_V32sS32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32sS32s_V32s", typeof(yepCore_Min_V32sS32s_V32s_Delegate));
     Core.yepCore_Min_V32uS32u_V32u = (yepCore_Min_V32uS32u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32uS32u_V32u", typeof(yepCore_Min_V32uS32u_V32u_Delegate));
     Core.yepCore_Min_V64sS32s_V64s = (yepCore_Min_V64sS32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64sS32s_V64s", typeof(yepCore_Min_V64sS32s_V64s_Delegate));
     Core.yepCore_Min_V64uS32u_V64u = (yepCore_Min_V64uS32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64uS32u_V64u", typeof(yepCore_Min_V64uS32u_V64u_Delegate));
     Core.yepCore_Min_V32fS32f_V32f = (yepCore_Min_V32fS32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V32fS32f_V32f", typeof(yepCore_Min_V32fS32f_V32f_Delegate));
     Core.yepCore_Min_V64fS64f_V64f = (yepCore_Min_V64fS64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Min_V64fS64f_V64f", typeof(yepCore_Min_V64fS64f_V64f_Delegate));
     Core.yepCore_Min_IV8sV8s_IV8s = (yepCore_Min_IV8sV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV8sV8s_IV8s", typeof(yepCore_Min_IV8sV8s_IV8s_Delegate));
     Core.yepCore_Min_IV8uV8u_IV8u = (yepCore_Min_IV8uV8u_IV8u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV8uV8u_IV8u", typeof(yepCore_Min_IV8uV8u_IV8u_Delegate));
     Core.yepCore_Min_IV16sV16s_IV16s = (yepCore_Min_IV16sV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV16sV16s_IV16s", typeof(yepCore_Min_IV16sV16s_IV16s_Delegate));
     Core.yepCore_Min_IV16uV16u_IV16u = (yepCore_Min_IV16uV16u_IV16u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV16uV16u_IV16u", typeof(yepCore_Min_IV16uV16u_IV16u_Delegate));
     Core.yepCore_Min_IV32sV32s_IV32s = (yepCore_Min_IV32sV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32sV32s_IV32s", typeof(yepCore_Min_IV32sV32s_IV32s_Delegate));
     Core.yepCore_Min_IV32uV32u_IV32u = (yepCore_Min_IV32uV32u_IV32u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32uV32u_IV32u", typeof(yepCore_Min_IV32uV32u_IV32u_Delegate));
     Core.yepCore_Min_IV64sV32s_IV64s = (yepCore_Min_IV64sV32s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64sV32s_IV64s", typeof(yepCore_Min_IV64sV32s_IV64s_Delegate));
     Core.yepCore_Min_IV64uV32u_IV64u = (yepCore_Min_IV64uV32u_IV64u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64uV32u_IV64u", typeof(yepCore_Min_IV64uV32u_IV64u_Delegate));
     Core.yepCore_Min_IV32fV32f_IV32f = (yepCore_Min_IV32fV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32fV32f_IV32f", typeof(yepCore_Min_IV32fV32f_IV32f_Delegate));
     Core.yepCore_Min_IV64fV64f_IV64f = (yepCore_Min_IV64fV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64fV64f_IV64f", typeof(yepCore_Min_IV64fV64f_IV64f_Delegate));
     Core.yepCore_Min_IV8sS8s_IV8s = (yepCore_Min_IV8sS8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV8sS8s_IV8s", typeof(yepCore_Min_IV8sS8s_IV8s_Delegate));
     Core.yepCore_Min_IV8uS8u_IV8u = (yepCore_Min_IV8uS8u_IV8u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV8uS8u_IV8u", typeof(yepCore_Min_IV8uS8u_IV8u_Delegate));
     Core.yepCore_Min_IV16sS16s_IV16s = (yepCore_Min_IV16sS16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV16sS16s_IV16s", typeof(yepCore_Min_IV16sS16s_IV16s_Delegate));
     Core.yepCore_Min_IV16uS16u_IV16u = (yepCore_Min_IV16uS16u_IV16u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV16uS16u_IV16u", typeof(yepCore_Min_IV16uS16u_IV16u_Delegate));
     Core.yepCore_Min_IV32sS32s_IV32s = (yepCore_Min_IV32sS32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32sS32s_IV32s", typeof(yepCore_Min_IV32sS32s_IV32s_Delegate));
     Core.yepCore_Min_IV32uS32u_IV32u = (yepCore_Min_IV32uS32u_IV32u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32uS32u_IV32u", typeof(yepCore_Min_IV32uS32u_IV32u_Delegate));
     Core.yepCore_Min_IV64sS32s_IV64s = (yepCore_Min_IV64sS32s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64sS32s_IV64s", typeof(yepCore_Min_IV64sS32s_IV64s_Delegate));
     Core.yepCore_Min_IV64uS32u_IV64u = (yepCore_Min_IV64uS32u_IV64u_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64uS32u_IV64u", typeof(yepCore_Min_IV64uS32u_IV64u_Delegate));
     Core.yepCore_Min_IV32fS32f_IV32f = (yepCore_Min_IV32fS32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV32fS32f_IV32f", typeof(yepCore_Min_IV32fS32f_IV32f_Delegate));
     Core.yepCore_Min_IV64fS64f_IV64f = (yepCore_Min_IV64fS64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Min_IV64fS64f_IV64f", typeof(yepCore_Min_IV64fS64f_IV64f_Delegate));
     Core.yepCore_Max_V8s_S8s = (yepCore_Max_V8s_S8s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8s_S8s", typeof(yepCore_Max_V8s_S8s_Delegate));
     Core.yepCore_Max_V8u_S8u = (yepCore_Max_V8u_S8u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8u_S8u", typeof(yepCore_Max_V8u_S8u_Delegate));
     Core.yepCore_Max_V16s_S16s = (yepCore_Max_V16s_S16s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16s_S16s", typeof(yepCore_Max_V16s_S16s_Delegate));
     Core.yepCore_Max_V16u_S16u = (yepCore_Max_V16u_S16u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16u_S16u", typeof(yepCore_Max_V16u_S16u_Delegate));
     Core.yepCore_Max_V32s_S32s = (yepCore_Max_V32s_S32s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32s_S32s", typeof(yepCore_Max_V32s_S32s_Delegate));
     Core.yepCore_Max_V32u_S32u = (yepCore_Max_V32u_S32u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32u_S32u", typeof(yepCore_Max_V32u_S32u_Delegate));
     Core.yepCore_Max_V64s_S64s = (yepCore_Max_V64s_S64s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64s_S64s", typeof(yepCore_Max_V64s_S64s_Delegate));
     Core.yepCore_Max_V64u_S64u = (yepCore_Max_V64u_S64u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64u_S64u", typeof(yepCore_Max_V64u_S64u_Delegate));
     Core.yepCore_Max_V32f_S32f = (yepCore_Max_V32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32f_S32f", typeof(yepCore_Max_V32f_S32f_Delegate));
     Core.yepCore_Max_V64f_S64f = (yepCore_Max_V64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64f_S64f", typeof(yepCore_Max_V64f_S64f_Delegate));
     Core.yepCore_Max_V8sV8s_V8s = (yepCore_Max_V8sV8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8sV8s_V8s", typeof(yepCore_Max_V8sV8s_V8s_Delegate));
     Core.yepCore_Max_V8uV8u_V8u = (yepCore_Max_V8uV8u_V8u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8uV8u_V8u", typeof(yepCore_Max_V8uV8u_V8u_Delegate));
     Core.yepCore_Max_V16sV16s_V16s = (yepCore_Max_V16sV16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16sV16s_V16s", typeof(yepCore_Max_V16sV16s_V16s_Delegate));
     Core.yepCore_Max_V16uV16u_V16u = (yepCore_Max_V16uV16u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16uV16u_V16u", typeof(yepCore_Max_V16uV16u_V16u_Delegate));
     Core.yepCore_Max_V32sV32s_V32s = (yepCore_Max_V32sV32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32sV32s_V32s", typeof(yepCore_Max_V32sV32s_V32s_Delegate));
     Core.yepCore_Max_V32uV32u_V32u = (yepCore_Max_V32uV32u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32uV32u_V32u", typeof(yepCore_Max_V32uV32u_V32u_Delegate));
     Core.yepCore_Max_V64sV32s_V64s = (yepCore_Max_V64sV32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64sV32s_V64s", typeof(yepCore_Max_V64sV32s_V64s_Delegate));
     Core.yepCore_Max_V64uV32u_V64u = (yepCore_Max_V64uV32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64uV32u_V64u", typeof(yepCore_Max_V64uV32u_V64u_Delegate));
     Core.yepCore_Max_V32fV32f_V32f = (yepCore_Max_V32fV32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32fV32f_V32f", typeof(yepCore_Max_V32fV32f_V32f_Delegate));
     Core.yepCore_Max_V64fV64f_V64f = (yepCore_Max_V64fV64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64fV64f_V64f", typeof(yepCore_Max_V64fV64f_V64f_Delegate));
     Core.yepCore_Max_V8sS8s_V8s = (yepCore_Max_V8sS8s_V8s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8sS8s_V8s", typeof(yepCore_Max_V8sS8s_V8s_Delegate));
     Core.yepCore_Max_V8uS8u_V8u = (yepCore_Max_V8uS8u_V8u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V8uS8u_V8u", typeof(yepCore_Max_V8uS8u_V8u_Delegate));
     Core.yepCore_Max_V16sS16s_V16s = (yepCore_Max_V16sS16s_V16s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16sS16s_V16s", typeof(yepCore_Max_V16sS16s_V16s_Delegate));
     Core.yepCore_Max_V16uS16u_V16u = (yepCore_Max_V16uS16u_V16u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V16uS16u_V16u", typeof(yepCore_Max_V16uS16u_V16u_Delegate));
     Core.yepCore_Max_V32sS32s_V32s = (yepCore_Max_V32sS32s_V32s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32sS32s_V32s", typeof(yepCore_Max_V32sS32s_V32s_Delegate));
     Core.yepCore_Max_V32uS32u_V32u = (yepCore_Max_V32uS32u_V32u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32uS32u_V32u", typeof(yepCore_Max_V32uS32u_V32u_Delegate));
     Core.yepCore_Max_V64sS32s_V64s = (yepCore_Max_V64sS32s_V64s_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64sS32s_V64s", typeof(yepCore_Max_V64sS32s_V64s_Delegate));
     Core.yepCore_Max_V64uS32u_V64u = (yepCore_Max_V64uS32u_V64u_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64uS32u_V64u", typeof(yepCore_Max_V64uS32u_V64u_Delegate));
     Core.yepCore_Max_V32fS32f_V32f = (yepCore_Max_V32fS32f_V32f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V32fS32f_V32f", typeof(yepCore_Max_V32fS32f_V32f_Delegate));
     Core.yepCore_Max_V64fS64f_V64f = (yepCore_Max_V64fS64f_V64f_Delegate)nativeLibrary.GetFunction("yepCore_Max_V64fS64f_V64f", typeof(yepCore_Max_V64fS64f_V64f_Delegate));
     Core.yepCore_Max_IV8sV8s_IV8s = (yepCore_Max_IV8sV8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV8sV8s_IV8s", typeof(yepCore_Max_IV8sV8s_IV8s_Delegate));
     Core.yepCore_Max_IV8uV8u_IV8u = (yepCore_Max_IV8uV8u_IV8u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV8uV8u_IV8u", typeof(yepCore_Max_IV8uV8u_IV8u_Delegate));
     Core.yepCore_Max_IV16sV16s_IV16s = (yepCore_Max_IV16sV16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV16sV16s_IV16s", typeof(yepCore_Max_IV16sV16s_IV16s_Delegate));
     Core.yepCore_Max_IV16uV16u_IV16u = (yepCore_Max_IV16uV16u_IV16u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV16uV16u_IV16u", typeof(yepCore_Max_IV16uV16u_IV16u_Delegate));
     Core.yepCore_Max_IV32sV32s_IV32s = (yepCore_Max_IV32sV32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32sV32s_IV32s", typeof(yepCore_Max_IV32sV32s_IV32s_Delegate));
     Core.yepCore_Max_IV32uV32u_IV32u = (yepCore_Max_IV32uV32u_IV32u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32uV32u_IV32u", typeof(yepCore_Max_IV32uV32u_IV32u_Delegate));
     Core.yepCore_Max_IV64sV32s_IV64s = (yepCore_Max_IV64sV32s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64sV32s_IV64s", typeof(yepCore_Max_IV64sV32s_IV64s_Delegate));
     Core.yepCore_Max_IV64uV32u_IV64u = (yepCore_Max_IV64uV32u_IV64u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64uV32u_IV64u", typeof(yepCore_Max_IV64uV32u_IV64u_Delegate));
     Core.yepCore_Max_IV32fV32f_IV32f = (yepCore_Max_IV32fV32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32fV32f_IV32f", typeof(yepCore_Max_IV32fV32f_IV32f_Delegate));
     Core.yepCore_Max_IV64fV64f_IV64f = (yepCore_Max_IV64fV64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64fV64f_IV64f", typeof(yepCore_Max_IV64fV64f_IV64f_Delegate));
     Core.yepCore_Max_IV8sS8s_IV8s = (yepCore_Max_IV8sS8s_IV8s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV8sS8s_IV8s", typeof(yepCore_Max_IV8sS8s_IV8s_Delegate));
     Core.yepCore_Max_IV8uS8u_IV8u = (yepCore_Max_IV8uS8u_IV8u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV8uS8u_IV8u", typeof(yepCore_Max_IV8uS8u_IV8u_Delegate));
     Core.yepCore_Max_IV16sS16s_IV16s = (yepCore_Max_IV16sS16s_IV16s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV16sS16s_IV16s", typeof(yepCore_Max_IV16sS16s_IV16s_Delegate));
     Core.yepCore_Max_IV16uS16u_IV16u = (yepCore_Max_IV16uS16u_IV16u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV16uS16u_IV16u", typeof(yepCore_Max_IV16uS16u_IV16u_Delegate));
     Core.yepCore_Max_IV32sS32s_IV32s = (yepCore_Max_IV32sS32s_IV32s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32sS32s_IV32s", typeof(yepCore_Max_IV32sS32s_IV32s_Delegate));
     Core.yepCore_Max_IV32uS32u_IV32u = (yepCore_Max_IV32uS32u_IV32u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32uS32u_IV32u", typeof(yepCore_Max_IV32uS32u_IV32u_Delegate));
     Core.yepCore_Max_IV64sS32s_IV64s = (yepCore_Max_IV64sS32s_IV64s_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64sS32s_IV64s", typeof(yepCore_Max_IV64sS32s_IV64s_Delegate));
     Core.yepCore_Max_IV64uS32u_IV64u = (yepCore_Max_IV64uS32u_IV64u_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64uS32u_IV64u", typeof(yepCore_Max_IV64uS32u_IV64u_Delegate));
     Core.yepCore_Max_IV32fS32f_IV32f = (yepCore_Max_IV32fS32f_IV32f_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV32fS32f_IV32f", typeof(yepCore_Max_IV32fS32f_IV32f_Delegate));
     Core.yepCore_Max_IV64fS64f_IV64f = (yepCore_Max_IV64fS64f_IV64f_Delegate)nativeLibrary.GetFunction("yepCore_Max_IV64fS64f_IV64f", typeof(yepCore_Max_IV64fS64f_IV64f_Delegate));
     Core.yepCore_Sum_V32f_S32f = (yepCore_Sum_V32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_Sum_V32f_S32f", typeof(yepCore_Sum_V32f_S32f_Delegate));
     Core.yepCore_Sum_V64f_S64f = (yepCore_Sum_V64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_Sum_V64f_S64f", typeof(yepCore_Sum_V64f_S64f_Delegate));
     Core.yepCore_SumAbs_V32f_S32f = (yepCore_SumAbs_V32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_SumAbs_V32f_S32f", typeof(yepCore_SumAbs_V32f_S32f_Delegate));
     Core.yepCore_SumAbs_V64f_S64f = (yepCore_SumAbs_V64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_SumAbs_V64f_S64f", typeof(yepCore_SumAbs_V64f_S64f_Delegate));
     Core.yepCore_SumSquares_V32f_S32f = (yepCore_SumSquares_V32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_SumSquares_V32f_S32f", typeof(yepCore_SumSquares_V32f_S32f_Delegate));
     Core.yepCore_SumSquares_V64f_S64f = (yepCore_SumSquares_V64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_SumSquares_V64f_S64f", typeof(yepCore_SumSquares_V64f_S64f_Delegate));
     Core.yepCore_DotProduct_V32fV32f_S32f = (yepCore_DotProduct_V32fV32f_S32f_Delegate)nativeLibrary.GetFunction("yepCore_DotProduct_V32fV32f_S32f", typeof(yepCore_DotProduct_V32fV32f_S32f_Delegate));
     Core.yepCore_DotProduct_V64fV64f_S64f = (yepCore_DotProduct_V64fV64f_S64f_Delegate)nativeLibrary.GetFunction("yepCore_DotProduct_V64fV64f_S64f", typeof(yepCore_DotProduct_V64fV64f_S64f_Delegate));
 }
Example #15
0
        unsafe static int Main(string[] args)
        {
            // Disable running on Windows 7 until IJW activation work is complete.
            if (Environment.OSVersion.Platform != PlatformID.Win32NT || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1))
            {
                return(100);
            }

            try
            {
                HostPolicyMock.Initialize(Environment.CurrentDirectory, null);

                // Load our fake mscoree to prevent .NET Framework from loading.
                NativeLibrary.Load(Path.Combine(Environment.CurrentDirectory, "mscoree.dll"));

                Console.WriteLine("Verify that we can load an IJW assembly from native code.");
                string ijwModulePath   = Path.Combine(Environment.CurrentDirectory, "IjwNativeCallingManagedDll.dll");
                IntPtr ijwNativeHandle = NativeLibrary.Load(ijwModulePath);

                using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
                           0,
                           ijwModulePath,
                           string.Empty,
                           string.Empty))
                    fixed(char *path = ijwModulePath)
                    {
                        InMemoryAssemblyLoader.LoadInMemoryAssembly(ijwNativeHandle, (IntPtr)path);
                    }

                NativeEntryPointDelegate nativeEntryPoint = Marshal.GetDelegateForFunctionPointer <NativeEntryPointDelegate>(NativeLibrary.GetExport(ijwNativeHandle, "NativeEntryPoint"));

                Assert.AreEqual(100, nativeEntryPoint());

                Console.WriteLine("Test calls from managed to native to managed when an IJW assembly was first loaded via native.");

                Assembly   ijwAssemblyManaged = Assembly.Load("IjwNativeCallingManagedDll");
                Type       testType           = ijwAssemblyManaged.GetType("TestClass");
                object     testInstance       = Activator.CreateInstance(testType);
                MethodInfo testMethod         = testType.GetMethod("ManagedEntryPoint");

                Assert.AreEqual(100, (int)testMethod.Invoke(testInstance, null));

                MethodInfo changeReturnedValueMethod = testType.GetMethod("ChangeReturnedValue");
                MethodInfo getReturnValueMethod      = testType.GetMethod("GetReturnValue");

                int newValue = 42;
                changeReturnedValueMethod.Invoke(null, new object[] { newValue });

                Assert.AreEqual(newValue, (int)getReturnValueMethod.Invoke(null, null));

                // Native images are only loaded into memory once. As a result, the stubs in the vtfixup table
                // will always point to JIT stubs that exist in the first ALC that the module was loaded into.
                // As a result, if an IJW module is loaded into two different ALCs, or if the module is
                // first loaded via a native call and then loaded via the managed loader, the call stack can change ALCs when
                // jumping from managed->native->managed code within the IJW module.
                Assert.AreEqual(100, (int)testMethod.Invoke(testInstance, null));
                return(100);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());

                return(101);
            }
        }
Example #16
0
 internal NativeLibrary(NativeLibrary.Internal native)
     : this(__CopyValue(native))
 {
 }
Example #17
0
 static NVMLFunctions()
 {
     NVMLLocator.EnsureNVMLCanBeLocated();
     NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), DllImportResolver);
 }
Example #18
0
 private static void* __CopyValue(NativeLibrary.__Internal native)
 {
     var ret = Marshal.AllocHGlobal(52);
     global::CppSharp.Parser.AST.NativeLibrary.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
     return ret.ToPointer();
 }
Example #19
0
        public T LoadMethod <T>(string libraryPath, string name, Encoding stringEncoding) where T : Delegate
        {
            if (!IsUsable)
            {
                throw new SecurityException(INativeLoader.SecurityExceptionMessage);
            }

            if (stringEncoding == Encoding.Default)
            {
                stringEncoding = null;
            }
            if (stringEncoding != null && !getEncodingMethods.ContainsKey(stringEncoding))
            {
                throw new NotSupportedException($"Encoding '{stringEncoding.BodyName}' is not supported.");
            }

            #region Getting native method
            if (!loadedLibraries.TryGetValue(libraryPath, out IntPtr library))
            {
                if (NativeLibrary.TryLoad(libraryPath, out library))
                {
                    loadedLibraries.Add(libraryPath, library);
                }
                else
                {
                    return(null);
                }
            }

            if (!NativeLibrary.TryGetExport(library, name, out IntPtr pointer))
            {
                return(null);
            }
            #endregion

            T      function   = Marshal.GetDelegateForFunctionPointer <T>(pointer);
            var    wrapper    = new NativeCall <T>(this, function);
            IntPtr wrapperPtr = GCHandle.ToIntPtr(wrapper.handle);
            wrappers.Add(wrapper);

            ParameterInfo[] parameters     = function.Method.GetParameters();
            Type[]          parameterTypes = parameters.Select(parameter => parameter.ParameterType).ToArray();
            Type            type           = typeof(NativeCall <T>);

            #region Generating secured wrapper method
            var   dynamicMethod = new DynamicMethod(name, function.Method.ReturnType, parameterTypes, typeof(NativeCall <>).Module, skipVisibility: true);
            var   il            = dynamicMethod.GetILGenerator();
            Label nativeCall    = il.DefineLabel();

            il.DeclareLocal(typeof(GCHandle));

            il.Emit(OpCodes.Ldc_I8, wrapperPtr.ToInt64());
            il.Emit(OpCodes.Newobj, intPtrConstructor);
            il.Emit(OpCodes.Call, fromIntPtrMethod);
            il.Emit(OpCodes.Stloc_0);
            il.Emit(OpCodes.Ldloca_S, 0);
            il.Emit(OpCodes.Call, handleGetTarget);
            il.Emit(OpCodes.Isinst, type);
            il.Emit(OpCodes.Dup);

            var getIsUsable = type.GetMethod($"get_{nameof(NativeCall<T>.IsUsable)}", BindingFlags.NonPublic | BindingFlags.Instance);
            il.Emit(OpCodes.Callvirt, getIsUsable);
            il.Emit(OpCodes.Brtrue_S, nativeCall);

            il.Emit(OpCodes.Ldstr, INativeLoader.SecurityExceptionMessage);
            il.Emit(OpCodes.Newobj, exceptionConstructor);
            il.Emit(OpCodes.Throw);

            il.MarkLabel(nativeCall);
            var nativeMethod = type.GetField(nameof(NativeCall <T> .nativeMethod), BindingFlags.NonPublic | BindingFlags.Instance);
            il.Emit(OpCodes.Ldfld, nativeMethod);
            for (int i = 0; i < parameters.Length; i++)
            {
                if (parameterTypes[i] == typeof(string) && stringEncoding != null)
                {
                    il.Emit(OpCodes.Call, getDefaultEncoding);
                    il.Emit(OpCodes.Call, getDefaultEncoding);
                    il.Emit(OpCodes.Call, getEncodingMethods[stringEncoding]);
                    il.Emit(OpCodes.Call, getDefaultEncoding);

                    il.Emit(OpCodes.Ldarg_S, i);
                    il.Emit(OpCodes.Call, getBytes);
                    il.Emit(OpCodes.Call, convertToTargetBytes);
                    il.Emit(OpCodes.Call, getString);
                }
                else
                {
                    il.Emit(OpCodes.Ldarg_S, i);
                }
            }
            il.Emit(OpCodes.Callvirt, typeof(T).GetMethod(nameof(Action.Invoke)));
            il.Emit(OpCodes.Ret);
            #endregion

            var securedCall = (T)dynamicMethod.CreateDelegate(typeof(T));
            wrapper.method = securedCall;

            return(securedCall);
        }
Example #20
0
 public static NativeLibrary __CreateInstance(NativeLibrary.Internal native)
 {
     return new NativeLibrary(native);
 }
Example #21
0
 static Bullet2PhysicsSystem()
 {
     // Preload proper libbulletc native library (depending on CPU type)
     NativeLibrary.PreloadLibrary("libbulletc.dll");
 }
Example #22
0
        /// <summary>
        /// Loads the specified libretro implementation. 
        /// <para></para>
        /// This core is not actually initialized until Initialize is called.
        /// </summary>
        /// <param name="filename">The filename of the dynamic library.</param>
        /// <param name="info">Info about the frontend to pass to the core.</param>
        /// <param name="multipleInstances">If this is true, the library may be copied to a temporary directory if another instance of it has already been loaded into process memory.</param>
        public Core(string filename, FrontendInfo info, bool multipleInstances = true)
        {
            if (!instances.ContainsKey(filename))
            {
                instances.Add(filename, 0);
            }
            instances[filename]++;
            if (multipleInstances && instances[filename] > 1)
            {
                string newFilename = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetFileName(filename) + "." + instances[filename].ToString();
                File.Copy(filename, newFilename, true);
                filename = newFilename;
                deleteOnExit = true;
            }
            frontEndInfo = info;
            core = new NativeLibrary(filename);
            LoadFunctions();    
            Variables = new Variables(new string[0], new string[0], new string[0][]);
            Screen = new Screen();
            Timing = new TimingInfo();
            envCallback = Core_Environment;
            vidCallback = Core_VideoRefresh;
            audCallback = Core_AudioSample;
            asbCallback = Core_AudioSampleBatch;
            inpCallback = Core_InputPoll;
            insCallback = Core_InputState;
            rumCallback = Core_Rumble;
            this.filename = filename;
            // this is used by Core_Environment
            unsafe
            {
                boolFalse = Marshal.AllocHGlobal(1);
                boolTrue = Marshal.AllocHGlobal(1);

                *((bool*)boolFalse) = false;
                *((bool*)boolTrue) = true;
            }
        }
Example #23
0
 public EffectCompiler()
 {
     NativeLibrary.PreloadLibrary("d3dcompiler_47.dll");
     SourceDirectories = new List <string>();
     UrlToFilePath     = new Dictionary <string, string>();
 }
Example #24
0
 // Register a call-back for native library resolution.
 public static void Register(Assembly assembly)
 {
     NativeLibrary.SetDllImportResolver(assembly, Map);
 }
Example #25
0
        public static void Start(string[] args)
        {
            Program.args = args;
            Console.WriteLine(
                "If your error is about Microsoft.DirectX.DirectInput, please install the latest directx redist from here http://www.microsoft.com/en-us/download/details.aspx?id=35 \n\n");
            Console.WriteLine("Debug under mono    MONO_LOG_LEVEL=debug mono MissionPlanner.exe");
            Console.WriteLine("To fix any filename case issues under mono use    export MONO_IOMAP=drive:case");

            Console.WriteLine("Data Dir " + Settings.GetDataDirectory());
            Console.WriteLine("Log Dir " + Settings.GetDefaultLogDir());
            Console.WriteLine("Running Dir " + Settings.GetRunningDirectory());
            Console.WriteLine("User Data Dir " + Settings.GetUserDataDirectory());

            var t = Type.GetType("Mono.Runtime");

            MONO = (t != null);

            Directory.SetCurrentDirectory(Settings.GetRunningDirectory());

            var listener = new TextWriterTraceListener(Settings.GetDataDirectory() + Path.DirectorySeparatorChar + "trace.log",
                                                       "defaulttrace");

            if (args.Any(a => a.Contains("trace")))
            {
                Trace.Listeners.Add(listener);
            }

            Thread = Thread.CurrentThread;

            System.Windows.Forms.Application.EnableVisualStyles();
            XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
            log.Info("******************* Logging Configured *******************");

            ServicePointManager.DefaultConnectionLimit = 10;

            System.Windows.Forms.Application.ThreadException += Application_ThreadException;

            if (args.Length > 0 && args[0] == "/update")
            {
                Utilities.Update.DoUpdate();
                return;
            }

            name = "Mission Planner";

            try
            {
                if (File.Exists(Settings.GetRunningDirectory() + "logo.txt"))
                {
                    name = File.ReadAllLines(Settings.GetRunningDirectory() + "logo.txt",
                                             Encoding.UTF8)[0];
                }
            }
            catch
            {
            }

            if (File.Exists(Settings.GetRunningDirectory() + "logo.png"))
            {
                Logo = new Bitmap(Settings.GetRunningDirectory() + "logo.png");
            }

            if (File.Exists(Settings.GetRunningDirectory() + "logo2.png"))
            {
                Logo2 = new Bitmap(Settings.GetRunningDirectory() + "logo2.png");
            }

            if (File.Exists(Settings.GetRunningDirectory() + "icon.png"))
            {
                // 128*128
                IconFile = new Bitmap(Settings.GetRunningDirectory() + "icon.png");
            }
            else
            {
                IconFile = MissionPlanner.Properties.Resources.mpdesktop.ToBitmap();
            }

            if (File.Exists(Settings.GetRunningDirectory() + "splashbg.png")) // 600*375
            {
                SplashBG = new Bitmap(Settings.GetRunningDirectory() + "splashbg.png");
            }

            try
            {
                var file = NativeLibrary.GetLibraryPathname("libSkiaSharp");
                var ptr  = NativeLibrary.LoadLibrary(file);
                if (ptr != IntPtr.Zero)
                {
                    log.Info("SkiaLoaded");
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

            Splash = new MissionPlanner.Splash();
            if (SplashBG != null)
            {
                Splash.BackgroundImage     = SplashBG;
                Splash.pictureBox1.Visible = false;
            }

            if (IconFile != null)
            {
                Splash.Icon = Icon.FromHandle(((Bitmap)IconFile).GetHicon());
            }

            string strVersion = File.Exists("version.txt")
                ? File.ReadAllText("version.txt")
                : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            Splash.Text = name + " " + Application.ProductVersion + " build " + strVersion;
            Splash.Show();

            if (Debugger.IsAttached)
            {
                Splash.TopMost = false;
            }

            Application.DoEvents();
            Application.DoEvents();

            CustomMessageBox.ShowEvent += (text, caption, buttons, icon, yestext, notext) =>
            {
                return((CustomMessageBox.DialogResult)(int) MsgBox.CustomMessageBox.Show(text, caption,
                                                                                         (MessageBoxButtons)(int)buttons, (MessageBoxIcon)(int)icon, yestext, notext));
            };

            // setup theme provider
            MsgBox.CustomMessageBox.ApplyTheme                  += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo;
            Controls.MainSwitcher.ApplyTheme                    += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo;
            MissionPlanner.Controls.InputBox.ApplyTheme         += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo;
            Controls.BackstageView.BackstageViewPage.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo;

            Controls.MainSwitcher.Tracking += MissionPlanner.Utilities.Tracking.AddPage;
            Controls.BackstageView.BackstageView.Tracking += MissionPlanner.Utilities.Tracking.AddPage;

            // setup settings provider
            MissionPlanner.Comms.CommsBase.Settings       += CommsBase_Settings;
            MissionPlanner.Comms.CommsBase.InputBoxShow   += CommsBaseOnInputBoxShow;
            MissionPlanner.Comms.CommsBase.ApplyTheme     += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo;
            MissionPlanner.Comms.SerialPort.GetDeviceName += SerialPort_GetDeviceName;

            MissionPlanner.Utilities.Extensions.MessageLoop = new Action(() => Application.DoEvents());

            // set the cache provider to my custom version
            GMap.NET.GMaps.Instance.PrimaryCache = new Maps.MyImageCache();
            // add my custom map providers
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.WMSProvider.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Custom.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Earthbuilder.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Statkart_Topo2.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Eniro_Topo.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapBox.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapboxNoFly.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapboxUser.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Lake.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1974.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1979.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1984.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1988.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Relief.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Slopezone.Instance);
            GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Sea.Instance);

            GoogleMapProvider.APIKey = "AIzaSyA5nFp39fEHruCezXnG3r8rGyZtuAkmCug";

            Tracking.productName               = Application.ProductName;
            Tracking.productVersion            = Application.ProductVersion;
            Tracking.currentCultureName        = Application.CurrentCulture.Name;
            Tracking.primaryScreenBitsPerPixel = Screen.PrimaryScreen.BitsPerPixel;
            Tracking.boundsWidth               = Screen.PrimaryScreen.Bounds.Width;
            Tracking.boundsHeight              = Screen.PrimaryScreen.Bounds.Height;

            Settings.Instance.UserAgent = Application.ProductName + " " + Application.ProductVersion + " (" + Environment.OSVersion.VersionString + ")";

            // optionally add gdal support
            if (Directory.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "gdal"))
            {
                GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance);
            }

            // add proxy settings
            GMap.NET.MapProviders.GMapProvider.WebProxy             = WebRequest.GetSystemWebProxy();
            GMap.NET.MapProviders.GMapProvider.WebProxy.Credentials = CredentialCache.DefaultCredentials;

            // generic status report screen
            MAVLinkInterface.CreateIProgressReporterDialogue += title =>
                                                                new ProgressReporterDialogue()
            {
                StartPosition = FormStartPosition.CenterScreen, Text = title
            };

            WebRequest.DefaultWebProxy             = WebRequest.GetSystemWebProxy();
            WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;

            if (name == "VVVVZ")
            {
                // set pw
                Settings.Instance["password"]         = "******";
                Settings.Instance["password_protect"] = "True";
                // prevent wizard
                Settings.Instance["newuser"] = "******";
                // invalidate update url
                System.Configuration.ConfigurationManager.AppSettings["UpdateLocationVersion"] = "";
            }

            CleanupFiles();

            log.InfoFormat("64bit os {0}, 64bit process {1}", System.Environment.Is64BitOperatingSystem,
                           System.Environment.Is64BitProcess);

            log.InfoFormat("Runtime Version {0}",
                           System.Reflection.Assembly.GetExecutingAssembly().ImageRuntimeVersion);

            try
            {
                log.Info(Process.GetCurrentProcess().Modules.ToJSON());
            }
            catch
            {
            }

            Type type = Type.GetType("Mono.Runtime");

            if (type != null)
            {
                MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
                if (displayName != null)
                {
                    log.Info(displayName.Invoke(null, null));
                    //6.6.0.161 (tarball Tue Dec 10 10:36:32 UTC 2019)

                    var match = Regex.Match(displayName.Invoke(null, null).ToString(), @"([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)");
                    if (match.Success)
                    {
                        if (int.Parse(match.Groups[1].Value) < 6)
                        {
                            CustomMessageBox.Show(
                                "Please upgrade your mono version to 6+ https://www.mono-project.com/download/stable/");
                        }
                    }
                }
            }

            try
            {
                Thread.CurrentThread.Name = "Base Thread";
                Application.Run(new MainV2());
            }
            catch (Exception ex)
            {
                log.Fatal("Fatal app exception", ex);
                Console.WriteLine(ex.ToString());

                Console.WriteLine("\nPress any key to exit!");
                Console.ReadLine();
            }

            try
            {
                // kill sim background process if its still running
                GCSViews.SITL.simulator.ForEach(a =>
                {
                    try
                    {
                        a.Kill();
                    }
                    catch { }
                });
            }
            catch
            {
            }
        }
Example #26
0
 static PdbWriter()
 {
     NativeLibrary.SetDllImportResolver(typeof(PdbWriter).Assembly, DllImportResolver);
 }
 public static void InitNativeLibMapping()
 {
     NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), MapAndLoad);
 }
Example #28
0
        static MsQuicApi()
        {
            if (OperatingSystem.IsWindows())
            {
                if (!IsWindowsVersionSupported())
                {
                    if (NetEventSource.Log.IsEnabled())
                    {
                        NetEventSource.Info(null, $"Current Windows version ({Environment.OSVersion}) is not supported by QUIC. Minimal supported version is {MinWindowsVersion}");
                    }

                    return;
                }

                Tls13MayBeDisabled = IsTls13Disabled();
            }

            IntPtr msQuicHandle;

            if (NativeLibrary.TryLoad($"{Interop.Libraries.MsQuic}.{MsQuicVersion.Major}", typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle) ||
                NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle))
            {
                try
                {
                    if (NativeLibrary.TryGetExport(msQuicHandle, "MsQuicOpenVersion", out IntPtr msQuicOpenVersionAddress))
                    {
                        QUIC_API_TABLE *apiTable;
                        delegate * unmanaged[Cdecl] < uint, QUIC_API_TABLE **, int > msQuicOpenVersion = (delegate * unmanaged[Cdecl] < uint, QUIC_API_TABLE **, int >)msQuicOpenVersionAddress;
                        if (StatusSucceeded(msQuicOpenVersion((uint)MsQuicVersion.Major, &apiTable)))
                        {
                            int   arraySize  = 4;
                            uint *libVersion = stackalloc uint[arraySize];
                            uint  size       = (uint)arraySize * sizeof(uint);
                            if (StatusSucceeded(apiTable->GetParam(null, QUIC_PARAM_GLOBAL_LIBRARY_VERSION, &size, libVersion)))
                            {
                                var version = new Version((int)libVersion[0], (int)libVersion[1], (int)libVersion[2], (int)libVersion[3]);
                                if (version >= MsQuicVersion)
                                {
                                    Api             = new MsQuicApi(apiTable);
                                    IsQuicSupported = true;
                                }
                                else
                                {
                                    if (NetEventSource.Log.IsEnabled())
                                    {
                                        NetEventSource.Info(null, $"Incompatible MsQuic library version '{version}', expecting '{MsQuicVersion}'");
                                    }
                                }
                            }
                        }
                    }
                }
                finally
                {
                    if (!IsQuicSupported)
                    {
                        NativeLibrary.Free(msQuicHandle);
                    }
                }
            }
        }
Example #29
0
    public static int Main()
    {
        bool success = true;

        Assembly assembly    = System.Reflection.Assembly.GetExecutingAssembly();
        string   testBinDir  = Path.GetDirectoryName(assembly.Location);
        string   libFullPath = NativeLibraryToLoad.GetFullPath();
        string   libName;
        IntPtr   handle;

        try
        {
            // -----------------------------------------------
            //         Simple LoadLibrary() API Tests
            // -----------------------------------------------

            // Calls on correct full-path to native lib
            libName  = libFullPath;
            success &= EXPECT(LoadLibrarySimple(libName));
            success &= EXPECT(TryLoadLibrarySimple(libName));

            // Calls on non-existant file
            libName  = Path.Combine(testBinDir, "notfound");
            success &= EXPECT(LoadLibrarySimple(libName), TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibrarySimple(libName), TestResult.ReturnFailure);

            // Calls on an invalid file
            libName  = Path.Combine(testBinDir, "NativeLibrary.cpp");
            success &= EXPECT(LoadLibrarySimple(libName),
                              (TestLibrary.Utilities.IsWindows) ? TestResult.BadImage : TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibrarySimple(libName), TestResult.ReturnFailure);

            // Calls on null input
            libName  = null;
            success &= EXPECT(LoadLibrarySimple(libName), TestResult.ArgumentNull);
            success &= EXPECT(TryLoadLibrarySimple(libName), TestResult.ArgumentNull);

            // -----------------------------------------------
            //         Advanced LoadLibrary() API Tests
            // -----------------------------------------------

            // Advanced LoadLibrary() API Tests
            // Calls on correct full-path to native lib
            libName  = libFullPath;
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null));
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null));

            // Calls on non-existant file
            libName  = Path.Combine(testBinDir, "notfound");
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null), TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null), TestResult.ReturnFailure);

            // Calls on an invalid file
            libName = Path.Combine(testBinDir, "NativeLibrary.cpp");
            // The VM can only distinguish BadImageFormatException from DllNotFoundException on Windows.
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null),
                              (TestLibrary.Utilities.IsWindows) ? TestResult.BadImage : TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null), TestResult.ReturnFailure);

            // Calls on just Native Library name
            libName  = NativeLibraryToLoad.Name;
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null));
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null));

            // Calls on Native Library name with correct prefix-suffix
            libName  = NativeLibraryToLoad.GetFileName();
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null));
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null));

            // Calls on full path without prefix-siffix
            libName = Path.Combine(testBinDir, NativeLibraryToLoad.Name);
            // DllImport doesn't add a prefix if the name is preceeded by a path specification.
            // Windows only needs a suffix, but Linux and Mac need both prefix and suffix
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, null),
                              (TestLibrary.Utilities.IsWindows) ? TestResult.Success : TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, null),
                              (TestLibrary.Utilities.IsWindows) ? TestResult.Success : TestResult.ReturnFailure);

            // Check for loading a native binary in the system32 directory.
            // The choice of the binary is arbitrary, and may not be available on
            // all Windows platforms (ex: Nano server)
            libName = "url.dll";
            if (TestLibrary.Utilities.IsWindows &&
                File.Exists(Path.Combine(Environment.SystemDirectory, libName)))
            {
                // Calls on a valid library from System32 directory
                success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32));
                success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32));

                // Calls on a valid library from application directory
                success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.DllNotFound);
                success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.ReturnFailure);
            }

            // Calls with null libName input
            success &= EXPECT(LoadLibraryAdvanced(null, assembly, null), TestResult.ArgumentNull);
            success &= EXPECT(TryLoadLibraryAdvanced(null, assembly, null), TestResult.ArgumentNull);

            // Calls with null assembly
            libName  = NativeLibraryToLoad.Name;
            success &= EXPECT(LoadLibraryAdvanced(libName, null, null), TestResult.ArgumentNull);
            success &= EXPECT(TryLoadLibraryAdvanced(libName, null, null), TestResult.ArgumentNull);

            // Ensure that a lib is not picked up from current directory when
            // a different full-path is specified.
            libName  = Path.Combine(testBinDir, Path.Combine("lib", NativeLibraryToLoad.Name));
            success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory), TestResult.DllNotFound);
            success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory), TestResult.ReturnFailure);

            // -----------------------------------------------
            //         FreeLibrary Tests
            // -----------------------------------------------

            libName = libFullPath;
            handle  = NativeLibrary.Load(libName);

            // Valid Free
            success &= EXPECT(FreeLibrary(handle));

            // Double Free
            if (TestLibrary.Utilities.IsWindows)
            {
                // The FreeLibrary() implementation simply calls the appropriate OS API
                // with the supplied handle. Not all OSes consistently return an error
                // when a library is double-freed.
                success &= EXPECT(FreeLibrary(handle), TestResult.InvalidOperation);
            }

            // Null Free
            success &= EXPECT(FreeLibrary(IntPtr.Zero));

            // -----------------------------------------------
            //         GetLibraryExport Tests
            // -----------------------------------------------
            libName = libFullPath;
            handle  = NativeLibrary.Load(libName);

            // Valid Call (with some hard-coded name mangling)
            success &= EXPECT(GetLibraryExport(handle, TestLibrary.Utilities.IsX86 ? "_NativeSum@8" : "NativeSum"));
            success &= EXPECT(TryGetLibraryExport(handle, TestLibrary.Utilities.IsX86 ? "_NativeSum@8" : "NativeSum"));

            // Call with null handle
            success &= EXPECT(GetLibraryExport(IntPtr.Zero, "NativeSum"), TestResult.ArgumentNull);
            success &= EXPECT(TryGetLibraryExport(IntPtr.Zero, "NativeSum"), TestResult.ArgumentNull);

            // Call with null string
            success &= EXPECT(GetLibraryExport(handle, null), TestResult.ArgumentNull);
            success &= EXPECT(TryGetLibraryExport(handle, null), TestResult.ArgumentNull);

            // Call with wrong string
            success &= EXPECT(GetLibraryExport(handle, "NonNativeSum"), TestResult.EntryPointNotFound);
            success &= EXPECT(TryGetLibraryExport(handle, "NonNativeSum"), TestResult.ReturnFailure);

            NativeLibrary.Free(handle);
        }
        catch (Exception e)
        {
            // Catch any exceptions in NativeLibrary calls directly within this function.
            // These calls are used to setup the environment for tests that follow, and are not expected to fail.
            // If they do fail (ex: incorrect build environment) fail with an error code, rather than segmentation fault.
            Console.WriteLine(String.Format("Unhandled exception {0}", e));
            success = false;
        }

        return((success) ? 100 : -100);
    }
Example #30
0
 static NvJpegNativeMethods()
 {
     NativeLibrary.SetDllImportResolver(typeof(NvJpegNativeMethods).Assembly, ImportResolver);
 }
Example #31
0
 static Proxy()
 {
     NativeLibrary.SetDllImportResolver(typeof(Proxy).Assembly, NativeLib.ImportResolver);
     Context = CreateContext();
 }
Example #32
0
        private static void LoadNativeLibrary(string path)
        {
            if (path == null)
            {
                return;
            }

#if NETCOREAPP3_0_OR_GREATER
            string runtimeIdentifier;
            string pdfiumLibName;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                runtimeIdentifier = RuntimeInformation.ProcessArchitecture switch
                {
                    Architecture.X86 => "win-x86",
                    Architecture.X64 => "win-x64",
                    Architecture.Arm64 => "win-arm64",
                    _ => throw new PlatformNotSupportedException("Only x86-64, x86 and win-arm64 are supported on Windows.")
                };
                pdfiumLibName = "pdfium.dll";
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                runtimeIdentifier = RuntimeInformation.ProcessArchitecture switch
                {
                    Architecture.X64 => "linux-x64",
                    Architecture.Arm => "linux-arm",
                    Architecture.Arm64 => "linux-arm64",
                    _ => throw new PlatformNotSupportedException("Only x86-64 and arm are supported on Linux.")
                };
                pdfiumLibName = "libpdfium.so";
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                runtimeIdentifier = RuntimeInformation.ProcessArchitecture switch
                {
                    Architecture.X64 => "osx-x64",
                    Architecture.Arm64 => "osx-arm64",
                    _ => throw new PlatformNotSupportedException("Only x86-64 and arm64 are supported on macOS.")
                };
                pdfiumLibName = "libpdfium.dylib";
            }
            else
            {
                throw new NotSupportedException("Only win-x86, win-x64, win-arm64, linux-x64, linux-arm, linux-arm64, osx-x64 and osx-arm64 are supported.");
            }

            if (File.Exists(Path.Combine(path, pdfiumLibName)))
            {
                // dotnet publish with a given runtime identifier (not portable) will put PDFium into the root folder
                _pdfiumLibPath = Path.Combine(path, pdfiumLibName);
            }
            else
            {
                // in any other case there should be a runtimes folder
                _pdfiumLibPath = Path.Combine(path, "runtimes", runtimeIdentifier, "native", pdfiumLibName);
            }


            NativeLibrary.SetDllImportResolver(typeof(NativeMethods).Assembly, ImportResolver);

            NativeLibrary.Load(_pdfiumLibPath, Assembly.GetExecutingAssembly(), default);
#else
            _pdfiumLibPath = Path.Combine(path, "runtimes", Environment.Is64BitProcess ? "win-x64" : "win-x86", "native", "pdfium.dll");

            LoadLibrary(_pdfiumLibPath);
#endif
        }
Example #33
0
 internal static T LoadFunction <T>(this NativeLibrary library,
                                    string name)
 {
     return(library.LoadFunction <T>(name));
 }
Example #34
0
 private NativeLibrary(NativeLibrary.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
 }
Example #35
0
        public override TaskOrResult <EffectBytecodeCompilerResult> Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters)
        {
            var log = new LoggerResult();

            // Load D3D compiler dll
            // Note: No lock, it's probably fine if it gets called from multiple threads at the same time.
            if (Platform.IsWindowsDesktop && !d3dCompilerLoaded)
            {
                NativeLibrary.PreloadLibrary("d3dcompiler_47.dll");
                d3dCompilerLoaded = true;
            }

            var shaderMixinSource = mixinTree;
            var fullEffectName    = mixinTree.Name;

            // Make a copy of shaderMixinSource. Use deep clone since shaderMixinSource can be altered during compilation (e.g. macros)
            var shaderMixinSourceCopy = new ShaderMixinSource();

            shaderMixinSourceCopy.DeepCloneFrom(shaderMixinSource);
            shaderMixinSource = shaderMixinSourceCopy;

            // Generate platform-specific macros
            switch (effectParameters.Platform)
            {
            case GraphicsPlatform.Direct3D11:
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_DIRECT3D", 1);
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_DIRECT3D11", 1);
                break;

            case GraphicsPlatform.Direct3D12:
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_DIRECT3D", 1);
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_DIRECT3D12", 1);
                break;

            case GraphicsPlatform.OpenGL:
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_OPENGL", 1);
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_OPENGLCORE", 1);
                break;

            case GraphicsPlatform.OpenGLES:
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_OPENGL", 1);
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_OPENGLES", 1);
                break;

            case GraphicsPlatform.Vulkan:
                shaderMixinSource.AddMacro("XENKO_GRAPHICS_API_VULKAN", 1);
                break;

            default:
                throw new NotSupportedException();
            }

            // Generate profile-specific macros
            shaderMixinSource.AddMacro("XENKO_GRAPHICS_PROFILE", (int)effectParameters.Profile);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_9_1", (int)GraphicsProfile.Level_9_1);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_9_2", (int)GraphicsProfile.Level_9_2);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_9_3", (int)GraphicsProfile.Level_9_3);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_10_0", (int)GraphicsProfile.Level_10_0);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_10_1", (int)GraphicsProfile.Level_10_1);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_11_0", (int)GraphicsProfile.Level_11_0);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_11_1", (int)GraphicsProfile.Level_11_1);
            shaderMixinSource.AddMacro("GRAPHICS_PROFILE_LEVEL_11_2", (int)GraphicsProfile.Level_11_2);

            // In .xksl, class has been renamed to shader to avoid ambiguities with HLSL
            shaderMixinSource.AddMacro("class", "shader");

            var parsingResult = GetMixinParser().Parse(shaderMixinSource, shaderMixinSource.Macros.ToArray());

            // Copy log from parser results to output
            CopyLogs(parsingResult, log);

            // Return directly if there are any errors
            if (parsingResult.HasErrors)
            {
                return(new EffectBytecodeCompilerResult(null, log));
            }

            // Convert the AST to HLSL
            var writer = new Xenko.Core.Shaders.Writer.Hlsl.HlslWriter
            {
                EnablePreprocessorLine = false // Allow to output links to original pdxsl via #line pragmas
            };

            writer.Visit(parsingResult.Shader);
            var shaderSourceText = writer.Text;

            if (string.IsNullOrEmpty(shaderSourceText))
            {
                log.Error($"No code generated for effect [{fullEffectName}]");
                return(new EffectBytecodeCompilerResult(null, log));
            }

            // -------------------------------------------------------
            // Save shader log
            // TODO: TEMP code to allow debugging generated shaders on Windows Desktop
#if XENKO_PLATFORM_WINDOWS_DESKTOP
            var shaderId = ObjectId.FromBytes(Encoding.UTF8.GetBytes(shaderSourceText));

            var logDir = Path.Combine(PlatformFolders.ApplicationBinaryDirectory, "log");
            if (!Directory.Exists(logDir))
            {
                Directory.CreateDirectory(logDir);
            }
            var shaderSourceFilename = Path.Combine(logDir, "shader_" + fullEffectName.Replace('.', '_') + "_" + shaderId + ".hlsl");
            lock (WriterLock) // protect write in case the same shader is created twice
            {
                // Write shader before generating to make sure that we are having a trace before compiling it (compiler may crash...etc.)
                if (!File.Exists(shaderSourceFilename))
                {
                    File.WriteAllText(shaderSourceFilename, shaderSourceText);
                }
            }
#else
            string shaderSourceFilename = null;
#endif
            // -------------------------------------------------------

            var bytecode = new EffectBytecode {
                Reflection = parsingResult.Reflection, HashSources = parsingResult.HashSources
            };

            // Select the correct backend compiler
            IShaderCompiler compiler;
            switch (effectParameters.Platform)
            {
#if XENKO_PLATFORM_WINDOWS
            case GraphicsPlatform.Direct3D11:
            case GraphicsPlatform.Direct3D12:
                compiler = new Direct3D.ShaderCompiler();
                break;
#endif
            case GraphicsPlatform.OpenGL:
            case GraphicsPlatform.OpenGLES:
            case GraphicsPlatform.Vulkan:
                // get the number of render target outputs
                var rtOutputs = 0;
                var psOutput  = parsingResult.Shader.Declarations.OfType <StructType>().FirstOrDefault(x => x.Name.Text == "PS_OUTPUT");
                if (psOutput != null)
                {
                    foreach (var rto in psOutput.Fields)
                    {
                        var sem = rto.Qualifiers.OfType <Semantic>().FirstOrDefault();
                        if (sem != null)
                        {
                            // special case SV_Target
                            if (rtOutputs == 0 && sem.Name.Text == "SV_Target")
                            {
                                rtOutputs = 1;
                                break;
                            }
                            for (var i = rtOutputs; i < 8; ++i)
                            {
                                if (sem.Name.Text == ("SV_Target" + i))
                                {
                                    rtOutputs = i + 1;
                                    break;
                                }
                            }
                        }
                    }
                }
                compiler = new OpenGL.ShaderCompiler(rtOutputs);
                break;

            default:
                throw new NotSupportedException();
            }

            var shaderStageBytecodes = new List <ShaderBytecode>();

#if XENKO_PLATFORM_WINDOWS_DESKTOP
            var stageStringBuilder = new StringBuilder();
#endif
            // if the shader (non-compute) does not have a pixel shader, we should add it for OpenGL and OpenGL ES.
            if ((effectParameters.Platform == GraphicsPlatform.OpenGL || effectParameters.Platform == GraphicsPlatform.OpenGLES) && !parsingResult.EntryPoints.ContainsKey(ShaderStage.Pixel) && !parsingResult.EntryPoints.ContainsKey(ShaderStage.Compute))
            {
                parsingResult.EntryPoints.Add(ShaderStage.Pixel, null);
            }

            foreach (var stageBinding in parsingResult.EntryPoints)
            {
                // Compile
                // TODO: We could compile stages in different threads to improve compiler throughput?
                var result = compiler.Compile(shaderSourceText, stageBinding.Value, stageBinding.Key, effectParameters, bytecode.Reflection, shaderSourceFilename);
                result.CopyTo(log);

                if (result.HasErrors)
                {
                    continue;
                }

                // -------------------------------------------------------
                // Append bytecode id to shader log
#if XENKO_PLATFORM_WINDOWS_DESKTOP
                stageStringBuilder.AppendLine("@G    {0} => {1}".ToFormat(stageBinding.Key, result.Bytecode.Id));
                if (result.DisassembleText != null)
                {
                    stageStringBuilder.Append(result.DisassembleText);
                }
#endif
                // -------------------------------------------------------

                shaderStageBytecodes.Add(result.Bytecode);

                // When this is a compute shader, there is no need to scan other stages
                if (stageBinding.Key == ShaderStage.Compute)
                {
                    break;
                }
            }

            // Remove unused reflection data, as it is entirely resolved at compile time.
            CleanupReflection(bytecode.Reflection);
            bytecode.Stages = shaderStageBytecodes.ToArray();

#if XENKO_PLATFORM_WINDOWS_DESKTOP
            int    shaderSourceLineOffset      = 0;
            int    shaderSourceCharacterOffset = 0;
            string outputShaderLog;
            lock (WriterLock) // protect write in case the same shader is created twice
            {
                var builder = new StringBuilder();
                builder.AppendLine("/**************************");
                builder.AppendLine("***** Compiler Parameters *****");
                builder.AppendLine("***************************");
                builder.Append("@P EffectName: ");
                builder.AppendLine(fullEffectName ?? "");
                builder.Append(compilerParameters?.ToStringPermutationsDetailed());
                builder.AppendLine("***************************");

                if (bytecode.Reflection.ConstantBuffers.Count > 0)
                {
                    builder.AppendLine("****  ConstantBuffers  ****");
                    builder.AppendLine("***************************");
                    foreach (var cBuffer in bytecode.Reflection.ConstantBuffers)
                    {
                        builder.AppendFormat("cbuffer {0} [Size: {1}]", cBuffer.Name, cBuffer.Size).AppendLine();
                        foreach (var parameter in cBuffer.Members)
                        {
                            builder.AppendFormat("@C    {0} => {1}", parameter.RawName, parameter.KeyInfo.KeyName).AppendLine();
                        }
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.Reflection.ResourceBindings.Count > 0)
                {
                    builder.AppendLine("******  Resources    ******");
                    builder.AppendLine("***************************");
                    foreach (var resource in bytecode.Reflection.ResourceBindings)
                    {
                        builder.AppendFormat("@R    {0} => {1} [Stage: {2}, Slot: ({3}-{4})]", resource.RawName, resource.KeyInfo.KeyName, resource.Stage, resource.SlotStart, resource.SlotStart + resource.SlotCount - 1).AppendLine();
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.HashSources.Count > 0)
                {
                    builder.AppendLine("*****     Sources     *****");
                    builder.AppendLine("***************************");
                    foreach (var hashSource in bytecode.HashSources)
                    {
                        builder.AppendFormat("@S    {0} => {1}", hashSource.Key, hashSource.Value).AppendLine();
                    }
                    builder.AppendLine("***************************");
                }

                if (bytecode.Stages.Length > 0)
                {
                    builder.AppendLine("*****     Stages      *****");
                    builder.AppendLine("***************************");
                    builder.Append(stageStringBuilder);
                    builder.AppendLine("***************************");
                }
                builder.AppendLine("*************************/");

                shaderSourceCharacterOffset = builder.Length;

                // Re-append the shader with all informations
                builder.Append(shaderSourceText);

                outputShaderLog = builder.ToString();
                File.WriteAllText(shaderSourceFilename, outputShaderLog);
            }

            // Count lines till source start
            for (int i = 0; i < shaderSourceCharacterOffset - 1;)
            {
                if (outputShaderLog[i] == '\r' && outputShaderLog[i + 1] == '\n')
                {
                    shaderSourceLineOffset++;
                    i += 2;
                }
                else
                {
                    i++;
                }
            }

            // Rewrite shader log
            Regex shaderLogReplace = new Regex(@"\.hlsl\((\d+),[0-9\-]+\):");
            foreach (var msg in log.Messages)
            {
                var match = shaderLogReplace.Match(msg.Text);
                if (match.Success)
                {
                    int line = int.Parse(match.Groups[1].Value);
                    line += shaderSourceLineOffset;

                    msg.Text = msg.Text.Remove(match.Groups[1].Index, match.Groups[1].Length)
                               .Insert(match.Groups[1].Index, line.ToString());
                }
            }
#endif

            return(new EffectBytecodeCompilerResult(bytecode, log));
        }
Example #36
0
 internal NativeLibrary(NativeLibrary.Internal native)
     : this(&native)
 {
 }
Example #37
0
 static ColliderShapeAssetCompiler()
 {
     NativeLibrary.PreloadLibrary("VHACD.dll", typeof(ColliderShapeAssetCompiler));
 }
Example #38
0
 public static NativeLibrary __CreateInstance(NativeLibrary.Internal native, bool skipVTables = false)
 {
     return new NativeLibrary(native, skipVTables);
 }
Example #39
0
        private static IntPtr LoadSqliteNativeLib(string libraryName, Assembly assembly, DllImportSearchPath?dllImportSearchPath)
        {
            var mappedName = OsInfo.IsLinux && libraryName == "sqlite3" ? "libsqlite3.so.0" : libraryName;

            return(NativeLibrary.Load(mappedName, assembly, dllImportSearchPath));
        }
Example #40
0
 protected NativeLibrary(NativeLibrary.Internal* native, bool skipVTables = false)
 {
     if (native == null)
         return;
     __Instance = new global::System.IntPtr(native);
 }
Example #41
0
        static OculusOvr()
        {
#if SILICONSTUDIO_PLATFORM_WINDOWS
            NativeLibrary.PreloadLibrary(NativeInvoke.Library + ".dll");
#endif
        }
Example #42
0
 private static NativeLibrary.Internal* __CopyValue(NativeLibrary.Internal native)
 {
     var ret = Marshal.AllocHGlobal(80);
     CppSharp.Parser.AST.NativeLibrary.Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return (NativeLibrary.Internal*) ret;
 }
Example #43
0
 static clang()
 {
     NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), OnDllImport);
 }
Example #44
0
 protected NativeLibrary(NativeLibrary.Internal* native, bool isInternalImpl = false)
 {
     __Instance = new global::System.IntPtr(native);
 }
Example #45
0
 private static bool TryResolveClangSharp(Assembly assembly, DllImportSearchPath?searchPath, out IntPtr nativeLibrary)
 {
     return(NativeLibrary.TryLoad("libClangSharp", assembly, searchPath, out nativeLibrary));
 }