Original post

Hi, this is my first post an question regarding and CGO.

I need to store a GO reference in C. currently I use the following pseudo-code:

  1. create a global map
    var lockService = make(map[MyUUID]MyInterface)
    (this is not thread-safe)

  2. save the MyUUID (which have the max length of a C-Pointer, 64bit) in C
    var uid MyUUID = (generate)
    lockService[uid] = MyInterfaceObject

  3. get my MyInterface back with:
    uid := C.MyUUIDget()

Question: is there a go “builtin” to solve the “export-handle” problem?