Пример #1
0
// Compile can be used to compile the specified database files.
//
// The created files are named from the basename(1) of each
// file argument with `.mgc` appended to it.
//
// We expect a colon separated list of database file paths.
func (m *Magic) Compile(file string) error {
	if m.ptr == nil {
		return ConnectionError
	}

	cf := C.CString(file)
	defer C.free(unsafe.Pointer(cf))

	C.magic_compile(m.ptr, cf)
	return m.check()
}
Пример #2
0
func Load(cookie Magic_t, filename string) int {
	cfilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cfilename))
	return (int)(C.magic_compile(cookie, cfilename))
}