コード例 #1
0
 protected override IntPtr CoreLoadNativeLibrary(string name)
 {
     return(NativeLibrary3.Load(name, Assembly.GetCallingAssembly(), null));
 }
コード例 #2
0
ファイル: NvvmAPI.cs プロジェクト: m4rs-mt/ILGPU
        private NvvmAPI(string libNvvmPath, string libDevicePath)
        {
            libNvvmModule  = NativeLibrary.Load(libNvvmPath);
            libDeviceBytes = !string.IsNullOrEmpty(libDevicePath)
                ? File.ReadAllBytes(libDevicePath)
                : Array.Empty <byte>();

            nvvmGetErrorString =
                Marshal.GetDelegateForFunctionPointer <NvvmGetErrorString>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmGetErrorString"));
            nvvmVersion =
                Marshal.GetDelegateForFunctionPointer <NvvmVersion>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmVersion"));
            nvvmIRVersion =
                Marshal.GetDelegateForFunctionPointer <NvvmIRVersion>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmIRVersion"));
            nvvmCreateProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmCreateProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmCreateProgram"));
            nvvmDestroyProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmDestroyProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmDestroyProgram"));
            nvvmAddModuleToProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmAddModuleToProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmAddModuleToProgram"));
            nvvmLazyAddModuleToProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmLazyAddModuleToProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmLazyAddModuleToProgram"));
            nvvmCompileProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmCompileProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmCompileProgram"));
            nvvmVerifyProgram =
                Marshal.GetDelegateForFunctionPointer <NvvmVerifyProgram>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmVerifyProgram"));
            nvvmGetCompiledResultSize =
                Marshal.GetDelegateForFunctionPointer <NvvmGetCompiledResultSize>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmGetCompiledResultSize"));
            nvvmGetCompiledResult =
                Marshal.GetDelegateForFunctionPointer <NvvmGetCompiledResult>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmGetCompiledResult"));
            nvvmGetProgramLogSize =
                Marshal.GetDelegateForFunctionPointer <NvvmGetProgramLogSize>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmGetProgramLogSize"));
            nvvmGetProgramLog =
                Marshal.GetDelegateForFunctionPointer <NvvmGetProgramLog>(
                    NativeLibrary.GetExport(
                        libNvvmModule,
                        "nvvmGetProgramLog"));
        }