// Run the host system's event loop func EnterLoop(title string, imageData []byte) { defer C.free(urlPtr) cTitle := C.CString(title) defer C.free(unsafe.Pointer(cTitle)) // Copy the image data into unmanaged memory cImageData := C.malloc(C.size_t(len(imageData))) defer C.free(cImageData) var cImageDataSlice []C.uchar sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&cImageDataSlice)) sliceHeader.Cap = len(imageData) sliceHeader.Len = len(imageData) sliceHeader.Data = uintptr(cImageData) for i, v := range imageData { cImageDataSlice[i] = C.uchar(v) } // Enter the loop C.native_loop(cTitle, &cImageDataSlice[0], C.uint(len(imageData))) // If reached, user clicked Exit isExiting = true }
// EnterLoop enters main loop. func EnterLoop() { C.native_loop() }
func EnterLoop() { go menuUpdateLoop() C.native_loop() isExiting = true }