Example #1
0
//export Init_go_fast_blank
func Init_go_fast_blank() {
	fmt.Println("go_fast_blank init")
	cs := C.CString("blank?")
	defer C.free(unsafe.Pointer(cs))

	C.rb_define_method(C.rb_cString, cs, (*[0]byte)(C.go_fast_blank), 0)
}
Example #2
0
func rb_define_method(klass C.VALUE, name string, fun unsafe.Pointer, args int) {
	cname := (*C.char)(unsafe.Pointer(&(*(*[]byte)(unsafe.Pointer(&name)))[0]))
	C.rb_define_method(klass, cname, (*[0]byte)(fun), C.int(args))
}