Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//go:build windows
 
package onnxruntime
 
import (
    "fmt"
    "syscall"
    "unsafe"
)
 
func platformLibraryName() string {
    return "onnxruntime.dll"
}
 
// libHandle is the platform handle for a loaded shared library.
type libHandle *syscall.DLL
 
// loadLibrary loads the shared library at path and resolves OrtGetApiBase.
// On success the caller owns the returned handle and must pass it to
// closeLibrary to unload the library.
func loadLibrary(path string) (unsafe.Pointer, libHandle, error) {
    if err := rejectNUL(path, "shared library path"); err != nil {
        return nil, nil, err
    }
    dll, err := syscall.LoadDLL(path)
    if err != nil {
        return nil, nil, fmt.Errorf("LoadDLL %s: %w", path, err)
    }
 
    proc, err := dll.FindProc("OrtGetApiBase")
    if err != nil {
        _ = dll.Release()
        return nil, nil, fmt.Errorf("FindProc OrtGetApiBase: %w", err)
    }
 
    return unsafe.Pointer(proc.Addr()), libHandle(dll), nil
}
 
// closeLibrary unloads a library previously returned by loadLibrary.
func closeLibrary(h libHandle) {
    if h != nil {
        _ = (*syscall.DLL)(h).Release()
    }
}