In today’s post I want to explore Odin’s C FFI.
As of today, Odin does not have a core networking library; something I consider to be an impediment to productivity.
I’ll start with a simple C program using BSD sockets for network communication, then look at Odin’s FFI mechanism, finally implementing a simple network program in Odin using HTTP.
BSD Sockets I’ve used BSD sockets before but only in a hobbyist capacity; nothing production worthy.
HandMadeSeattle (HMS) happened this year!
HandMadeCon (HMC) was renamed and it’s more of a community-focused event lead by the indefatiguable Abner Coimbre. I was a little hesitant about going this year since it was on hiatus since 2016 and there’s a slight change in direction; but I’m extremely happy with how it turned out.
I met a bunch of people, some old faces and lots of new faces. Of particular relevance to this blog post are two developers I got to hang out with; Andrew Kelley, creator of Zig, and Ginger Bill, creator of Odin
Introduction I started programming in C relatively recently; about 2016. Prior to this I had a fair amount of exposure to C++ through university, and through my first job at Electronic Arts. I am one of those people who would write “C/C++” because I knew enough C to make my way around; but I was natively a C++ programmer.
Learning C has been interesting. I feel now that I have a fairly thorough understanding of how C works as a language and programming environment, and I intend to share some of that understanding in this post.
Today we learn how little I know about system administration.
I host most of my own “cloud” services on a VPS I rent from SSDNodes. Recently I purchased an upgraded KVM node for reasons of which I’ll get into later. Anyway, I ran into a hiccup while trying to start migrating from my older VPS.
└─ curl 184.108.40.206 curl: (56) Recv failure: Connection reset by peer Hmm.
NOTE: First of all, I know the machine is reachable because I can SSH into it.
I finally took the opportunity to jump back into RISC-V, Go and QEMU as a followup to my previous exploration.1
I had a difficult time understanding exactly what was required to run my compiled Go program in QEMU. Let’s take a look at the instructions.2
Compile and run in qemu-riscv64 (which is expected to be in PATH):
$ GOARCH=riscv GOOS=linux go run ../riscvtest/add.go Build:
$ GOARCH=riscv GOOS=linux go build .
I’m working on a side project to gain more exposure to different kinds of projects in Go. This one is a pretty typical web application involving multiple authenticated users. For data storage I’m using PostgreSQL for its UUID type and cryptographic extensions. The cryptographic extensions are interesting, because of things like chkpass1.
My project right now is using chkpass for storing user passwords. Almost immediately after hooking this up I started wondering how chkpass actually works.
It’s been a long time since I’ve posted here. So what’s up?
I’ve been working at Lendesk in a team lead / senior developer role and trying to pursue my interest in Go and Linux. This has been a very tricky path to navigate as work has abandoned any pretense of plans to adopt Go and all work machines are MacOS. Thankfully, I’ve been able to carve out some personal time to keep poking around in my area of interest.
After lunch today I made a visit to a local boardgame store just to see what was new. The local gamestore near my place is much cheaper, but has a drastically different selection, so it’s always nice to see what else is available.
There were two notable games on today’s visit:
Agricola: Family Edition Android: Mainframe I’ve seen mention of Agricola: Family Edition before, so that was neat to see in person.
Race for the Galaxy is out now on Android1.
This features Keldon Jones’ AI2 and is the best digital version I’ve seen. It translates wonderfully and is easily worth the ten bucks.
Footnotes 1Race for the Galaxy on Google Play
2Keldon Jones’ Race for the Galaxy AI