// Code generated by asuka native. DO NOT EDIT. // asuka:native f84252246ecd432c package netcfg import ( "github.com/egoist/asuka/native" ) // nativeModule is the package's native code, as the hosts find it. var nativeModule = &native.Module{ID: "github.com/openchamber/openchamber-native/netcfg", Swift: "AsukaModule_github_com_openchamber_openchamber_native_netcfg", Kotlin: "com.github.openchamber.openchamber_native.netcfg.AsukaModule", Errors: []error{}} // NewNetcfg makes the platform's Netcfg: Go's, where the package implements it // in Go (implementNetcfg), else its native code's (Swift on iOS and macOS, // Kotlin on Android, JavaScript on the web). Without one, it returns an // error that is errors.ErrUnsupported. func NewNetcfg() (Netcfg, error) { if nativeImplNetcfg != nil { return nativeImplNetcfg() } o, err := nativeModule.New(0, "Netcfg") if err != nil { return nil, err } return &nativeNetcfg{o}, nil } var nativeImplNetcfg func() (Netcfg, error) // implementNetcfg makes NewNetcfg return Go's implementation: call it from an // init function of a file built for the platforms where the package's // native code is Go (Windows, Linux). func implementNetcfg(make func() (Netcfg, error)) { nativeImplNetcfg = make } // nativeNetcfg is a Netcfg on the platform's side. type nativeNetcfg struct{ o *native.Object } func (x *nativeNetcfg) Hello(name string) (string, error) { w := native.NewWriter() w.String(name) r, err := x.o.Call(1, w) if err != nil { return "", err } v := r.String() if err := r.Done(); err != nil { return "", err } return v, nil }