needs to make some calls to a library written in C. The library is not
trivial but also not horribly complicated: about a dozen typedefs/structs
and about 50 function calls (could potentially grow over time). The
functions when called will either get some data from somewhere else and
return it or take some data from the caller and send it/write it to some
other system.The choices I have:
(1) cgo and call directly into the C library. The problem here is that I'm
not a C expert and the C library makes heavy use of pointers to structs and
to primitive types that the caller must allocate (e.g. the typical C int*
len, data_t* data, uint8* buf). From briefly looking at cgo it seems that I
would have to allocate memory and free it on the Go side, at least in some
cases. Memory management and leaks scare me :)
(2) Suggest to the library author (coworker of mine) to provide and RPC/IPC
type service to the library that I could simply connect to from Go, e.g.
via a unix socket or some other form of RPC/IPC (e.g. gRPC). Any
suggestions here and how to deal with the authentication/authorization
part? I'd like to make sure that it's secure even though it will run on the
Performance is not the main concern (as long as it's not horrible and too
heavy handed, e.g. HTTP/REST/JSON API would be too much). Correctness is.
Any recommendations between (1) and (2)? Have you tackled a similar problem?
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.