search for: generate_golang_libnbd_go

Displaying 4 results from an estimated 4 matches for "generate_golang_libnbd_go".

2020 Mar 17
0
[PATCH libnbd] Add outline framework for Go language bindings (golang).
...You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* Go language bindings. *) + +open Printf + +open API +open Utils + +let generate_golang_libnbd_go () = + generate_header CStyle; + + pr "\ +package libnbd + +/* +#cgo CFLAGS: +#cgo LDFLAGS: -lnbd +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include \"libnbd.h\" +*/ +import \"C\" + +import ( + \"fmt\" + \"runtim...
2020 Mar 17
5
[PATCH libnbd v2 0/3] Unfinished golang bindings.
These bindings get as far as running very simple connections. However there are many missing parts still: * No callbacks. * No functions which handle buffers (pread/pwrite!) This is posted just for general early interest, not even for review. Rich.
2020 Mar 17
0
[PATCH libnbd v2 2/3] Add outline framework for Go language bindings (golang).
...You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* Go language bindings. *) + +open Printf + +open API +open Utils + +let generate_golang_libnbd_go () = + generate_header CStyle; + + pr "\ +package libnbd + +/* +#cgo CFLAGS: +#cgo LDFLAGS: -lnbd + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include \"libnbd.h\" + +struct error { + char *error; + int errnum;...
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...| RString -> + pr " r := C.GoString (ret)\n"; + pr " C.free (unsafe.Pointer (ret))\n"; + pr " return &r, nil\n" + | RUInt -> + pr " return uint (ret), nil\n" + ); + pr "}\n"; + pr "\n" + let generate_golang_libnbd_go () = generate_header CStyle; @@ -62,14 +360,20 @@ free_error (struct error *err) static struct nbd_handle * _nbd_create_wrapper (struct error *err) { - struct nbd_handle *r; + struct nbd_handle *ret; - r = nbd_create (); - if (r == NULL) + ret = nbd_create (); + if (ret == NULL)...