Exemple #1
0
 protected override IntPtr CoreLoadFunctionPointer(IntPtr handle, string functionName)
 {
     return(NativeLibrary3.GetExport(handle, functionName));
 }
Exemple #2
0
        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"));
        }