Example #1
0
// Init initializes the ClamAV library
func Init() error {
	err := ErrorCode(C.cl_init(C.uint(InitDefault)))
	if err != Success {
		return fmt.Errorf("Init: %v", StrError(err))
	}
	return nil
}
Example #2
0
func init() {
	// Prepare libclamav
	var ret C.int
	ret = C.cl_init(C.CL_INIT_DEFAULT)
	if ret != C.CL_SUCCESS {
		panic("cannot initialize clamav:" + C.GoString(C.cl_strerror(ret)))
	}
}
Example #3
0
// Init initializes the ClamAV library. A suitable initialization can be
// achieved by passing clamav.InitDefault to this function.
func Init(flags uint) error {
	var onceerr error
	initOnce.Do(func() {
		err := ErrorCode(C.cl_init(C.uint(flags)))
		if err != Success {
			onceerr = fmt.Errorf("Init: %v", StrError(err))
			return
		}
		InitCrypto()
	})
	return onceerr
}