func NewCompiler() (*Compiler, error) {
	var yrCompiler *C.YR_COMPILER
	if err := newError(C.yr_compiler_create(&yrCompiler)); err != nil {
		return nil, err
	}
	c := &Compiler{cptr: yrCompiler}
	runtime.SetFinalizer(c, (*Compiler).Destroy)
	return c, nil
}
NewCompiler creates a YARA compiler.
package yara
import "C"
import (
	"errors"
	"os"
	"reflect"
	"runtime"
	"unsafe"
)
func compilerCallback(errorLevel C.int, filename *C.char, linenumber C.int, rule *C.YR_RULE, message *C.char, userData unsafe.Pointer) {
	c := callbackData.Get(userData).(*Compiler)
	msg := CompilerMessage{
		Filename: C.GoString(filename),
		Line:     int(linenumber),
		Text:     C.GoString(message),
	}
	switch errorLevel {
	case C.YARA_ERROR_LEVEL_ERROR:
		c.Errors = append(c.Errors, msg)
	case C.YARA_ERROR_LEVEL_WARNING:
		c.Warnings = append(c.Warnings, msg)
	}
}
type Compiler struct {
	Errors   []CompilerMessage
	Warnings []CompilerMessage
	callbackData unsafe.Pointer
	cptr         *C.YR_COMPILER
}
type CompilerMessage struct {
	Filename string
	Line     int
	Text     string
}