libipfs.so

I have had an idea floating around for a while now about a C interface to IPFS. Today, I stumbled upon this thread about using ipfs as a library. I remembered the C-library idea and was able to find this article about how to make go libraries that can be called from C. And thus I dove head-first down the rabbit hole and spent the next two hours creating a proof-of-concept C bindings for go-ipfs.

So far, barely anything has been done. I’ve been using porting the example in go-ipfs/docs/examples/go-ipfs-as-a-library/main.go to crystal to give myself direction on what API functions to implement first. One thing of note is that I am not going to be passing pointers to go objects thru the API, and instead using handles. This way, the go runtime can handle the memory management for go objects and have the external program responsible for managing and releasing the handles.

One thing to note, today is the first time I’ve programmed in go. The assignment operator (:=) reminds me of Pascal. I’ve wanted to help with the IPFS project but it being written in go and me being reluctant to spend the time to learn yet another programming language has held me back. Looks like that is going to have to change.

Anyone interested can find the git repo containing my current progress here.

Comments