Method ctor Go binding.

Accepts an `unsafe.Pointer` for the `cfish_method_t` implementing
function.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/a3ce8dd8
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/a3ce8dd8
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/a3ce8dd8

Branch: refs/heads/master
Commit: a3ce8dd881b57cb9a9d4b63bc03c6da0f725076a
Parents: f8c60c4
Author: Marvin Humphrey <[email protected]>
Authored: Fri Aug 7 18:22:55 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Sun Aug 9 19:00:35 2015 -0700

----------------------------------------------------------------------
 runtime/go/clownfish/clownfish.go | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a3ce8dd8/runtime/go/clownfish/clownfish.go
----------------------------------------------------------------------
diff --git a/runtime/go/clownfish/clownfish.go 
b/runtime/go/clownfish/clownfish.go
index f6dfb27..be96655 100644
--- a/runtime/go/clownfish/clownfish.go
+++ b/runtime/go/clownfish/clownfish.go
@@ -142,6 +142,14 @@ func (c *ClassIMP) GetMethods() []Method {
        return meths
 }
 
+func NewMethod(name string, callbackFunc unsafe.Pointer, offset uint32) Method 
{
+       nameCF := (*C.cfish_String)(GoToString(name))
+       defer C.cfish_decref(unsafe.Pointer(nameCF))
+       methCF := C.cfish_Method_new(nameCF, C.cfish_method_t(callbackFunc),
+               C.uint32_t(offset));
+       return WRAPMethod(unsafe.Pointer(methCF))
+}
+
 func NewString(goString string) String {
        str := C.CString(goString)
        len := C.size_t(len(goString))

Reply via email to