Beispiel #1
0
//export swift_io_v_impl_google_rt_VRuntimeImpl_nativeWithNewClient
func swift_io_v_impl_google_rt_VRuntimeImpl_nativeWithNewClient(ctxHandle C.GoContextHandle, errOut *C.SwiftVError) C.GoContextHandle {
	ctx := scontext.GoContext(uint64(ctxHandle))
	// No options supported yet.
	newCtx, _, err := v23.WithNewClient(ctx)
	if err != nil {
		sutil.ThrowSwiftError(ctx, err, unsafe.Pointer(errOut))
		return C.GoContextHandle(0)
	}

	return C.GoContextHandle(scontext.SwiftContext(newCtx))
}
Beispiel #2
0
//export swift_io_v_impl_google_rt_VRuntimeImpl_nativeInit
func swift_io_v_impl_google_rt_VRuntimeImpl_nativeInit() C.GoContextHandle {
	ctx, shutdownFunc := v23.Init()
	ctx = context.WithValue(ctx, shutdownKey{}, shutdownFunc)
	return C.GoContextHandle(scontext.SwiftContext(ctx))
}
Beispiel #3
0
// Converts a Go Context into a native pointer for Swift and increments the go reference count
func SwiftContext(ctx *context.T) C.GoContextHandle {
	id := sutil.GoNewRef(ctx)
	return C.GoContextHandle(id)
}