// NewCompiler creates a YARA compiler. func NewCompiler() (*Compiler, error) { var yrCompiler *C.YR_COMPILER if err := newError(C.yr_compiler_create(&yrCompiler)); err != nil { return nil, err } c := &Compiler{compiler: &compiler{cptr: yrCompiler}} runtime.SetFinalizer(c.compiler, (*compiler).finalize) return c, nil }
func NewCompiler() (*Compiler, error) { var handle *C.YR_COMPILER code := C.yr_compiler_create(&handle) if code != C.ERROR_SUCCESS { return nil, Error(code) } return &Compiler{handle}, nil }