Last active
September 14, 2018 21:59
-
-
Save astagi/217d3ee05923c7e427bd5669668c6879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// #cgo pkg-config: python3 | |
// #include <Python.h> | |
// int PyArg_ParseTuple_LL(PyObject *, long long *, long long *); | |
import "C" | |
import ( | |
"fmt" | |
) | |
//export sum | |
func sum(self, args *C.PyObject) *C.PyObject { | |
var a, b C.longlong | |
if C.PyArg_ParseTuple_LL(args, &a, &b) == 0 { | |
return nil | |
} | |
return C.PyLong_FromLongLong(a + b) | |
} | |
func main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment