github.com/moontrade/mdbx-go@v0.4.0/internal/unsafecgo/cgo/stub.go (about)

     1  package cgo
     2  
     3  /*
     4  #include <stdio.h>
     5  #include <time.h>
     6  #include <unistd.h>
     7  
     8  void mdbx_unsafecgo_stub() {}
     9  
    10  typedef void mdbx_unsafecgo_trampoline_handler(size_t arg0, size_t arg1);
    11  
    12  void mdbx_unsafecgo_cgo_call(size_t fn, size_t arg0, size_t arg1) {
    13  	((mdbx_unsafecgo_trampoline_handler*)fn)(arg0, arg1);
    14  }
    15  */
    16  import "C"
    17  import "unsafe"
    18  
    19  var (
    20  	Stub = C.mdbx_unsafecgo_stub
    21  )
    22  
    23  func CGO() {
    24  	C.mdbx_unsafecgo_stub()
    25  }
    26  
    27  func NonBlocking(fn *byte, arg0, arg1 uintptr) {
    28  	Blocking(fn, arg0, arg1)
    29  }
    30  
    31  func Blocking(fn *byte, arg0, arg1 uintptr) {
    32  	C.mdbx_unsafecgo_cgo_call((C.size_t)(uintptr(unsafe.Pointer(fn))), (C.size_t)(arg0), (C.size_t)(arg1))
    33  }