Exemplo n.º 1
0
        protected override IntPtr GetJitAddress()
        {
            string jitLibraryName = string.Empty;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                jitLibraryName = "clrjit.dll";
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                jitLibraryName = "libclrjit.so";
            }
            else
            {
                jitLibraryName = "libclrjit.dylib";
            }

            LibraryLoader?defaultLoader = LibraryLoader.GetPlatformDefaultLoader();

            IntPtr libAddress    = defaultLoader.LoadNativeLibrary(jitLibraryName);
            IntPtr getJitAddress = defaultLoader.LoadFunctionPointer(libAddress, "getJit");

            GetJitDelegate getJit     = Marshal.GetDelegateForFunctionPointer <GetJitDelegate>(getJitAddress);
            IntPtr         jitAddress = getJit();

            return(jitAddress);
        }
Exemplo n.º 2
0
        public SolcLibDynamicProvider()
        {
            NativeLibFilePath = LibPathResolver.Resolve(LIB_FILE);
            var libPathResolver = new CustomResolver(NativeLibFilePath);

            _native = new NativeLibrary(LIB_FILE, LibraryLoader.GetPlatformDefaultLoader(), libPathResolver);

            _compileStandard     = LoadFunction <CompileStandardDelegate>("compileStandard");
            _compileJson         = LoadFunction <CompileJsonDelegate>("compileJSON");
            _compileJsonMulti    = LoadFunction <CompileJsonMultiDelegate>("compileJSONMulti");
            _compileJsonCallback = LoadFunction <CompileJsonCallbackDelegate>("compileJSONCallback");
            _license             = LoadFunction <LicenseDelegate>("license");
            _version             = LoadFunction <VersionDelegate>("version");
        }