rust2go-cli 0.0.1

rust2go commandline tool
package main

/*
// Generated by rust2go. Please DO NOT edit this C part manually.

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct StringRef {
  const uint8_t *ptr;
  uintptr_t len;
} StringRef;

typedef struct DemoResponseRef {
  bool pass;
} DemoResponseRef;

typedef struct WakerRef {
  const void *ptr;
  const void *vtable;
} WakerRef;

typedef struct DemoRequestRef {
  struct StringRef name;
  uint8_t age;
} DemoRequestRef;

// hack from: https://stackoverflow.com/a/69904977
__attribute__((weak))
void DemoCall_demo_check_cb(const void *f_ptr, struct DemoResponseRef resp, const void *slot) {
    ((void (*)(struct DemoResponseRef, const void*))f_ptr)(resp, slot);
}

// hack from: https://stackoverflow.com/a/69904977
__attribute__((weak))
void DemoCall_demo_check_async_cb(const void *f_ptr, struct WakerRef waker, struct DemoResponseRef resp, const void *slot) {
    ((void (*)(struct WakerRef, struct DemoResponseRef, const void*))f_ptr)(waker, resp, slot);
}
*/
import "C"
import "unsafe"

//export CDemoCall_demo_check
func CDemoCall_demo_check(_ C.DemoRequestRef, slot *C.void, cb *C.void) {
    // user logic
    resp := C.DemoResponseRef{}
    C.DemoCall_demo_check_cb(unsafe.Pointer(cb), resp, unsafe.Pointer(slot))
}
//export CDemoCall_demo_check_async
func CDemoCall_demo_check_async(w C.WakerRef, _ C.DemoRequestRef, slot *C.void, cb *C.void) {
    go func() {
        // user logic
        resp := C.DemoResponseRef{}
        C.DemoCall_demo_check_async_cb(unsafe.Pointer(cb), w, resp, unsafe.Pointer(slot))
    }()
}
func main() {}