Исходный код СУБД 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
//go:build !windows
 
package onnxruntime
 
/*
#include "cshim.h"
#include <stdlib.h>
*/
import "C"
import (
    "unsafe"
)
 
// ortPath converts path to a NUL-terminated ORTCHAR_T* for the ORT C API.
// The returned release func must be called once the C call has returned.
//
// On POSIX ORTCHAR_T is char, so the path is passed through as UTF-8.
func ortPath(path string) (*C.ORTCHAR_T, func(), error) {
    if err := rejectNUL(path, "path"); err != nil {
        return nil, func() {}, err
    }
    // C.ORTCHAR_T is an alias for C.char here, so C.CString needs no conversion.
    p := C.CString(path)
    return p, func() { C.free(unsafe.Pointer(p)) }, nil
}