Esempio n. 1
0
func init() {
	var err error
	ctx, err = C.zmq_ctx_new()
	if ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
}
Esempio n. 2
0
func init() {
	var err error
	defaultCtx = &Context{}
	defaultCtx.ctx, err = C.zmq_ctx_new()
	defaultCtx.opened = true
	if defaultCtx.ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
}
Esempio n. 3
0
File: zmq4.go Progetto: gallir/zmq4
// Create a new context.
func NewContext() (ctx *Context, err error) {
	ctx = &Context{}
	c, e := C.zmq_ctx_new()
	if c == nil {
		err = errget(e)
		ctx.err = err
	} else {
		ctx.ctx = c
		ctx.opened = true
		runtime.SetFinalizer(ctx, (*Context).Term)
	}
	return
}
Esempio n. 4
0
File: zmq4.go Progetto: gallir/zmq4
func init() {
	var err error
	defaultCtx = &Context{}
	defaultCtx.ctx, err = C.zmq_ctx_new()
	defaultCtx.opened = true
	if defaultCtx.ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
	major, minor, patch = Version()
	if major != 4 {
		panic("Using zmq4 with ZeroMQ major version " + fmt.Sprint(major))
	}
	if major != int(C.zmq4_major) || minor != int(C.zmq4_minor) {
		panic(
			fmt.Sprintf(
				"zmq4 was installed with ZeroMQ version %d.%d.%d, but the application links with version %d.%d.%d",
				int(C.zmq4_major), int(C.zmq4_minor), int(C.zmq4_patch),
				major, minor, patch))
	}
}
Esempio n. 5
0
func createZmqContext() unsafe.Pointer {
	return C.zmq_ctx_new()
}