How do libraries like OpenCV and ImageMagick written in C,

Arpit Bhayani

Arpit Bhayani

Dec 07, 2023 • 1 min read


How do libraries like OpenCV and ImageMagick written in C, work in Go? ⚡

Some of the world’s most popular libraries are written in C for their performance and over the years they have become pretty stable. But, what if I want to use them in my Go code?

Rewriting the entire library in Go is not a possible option, and hence Go offers a tool called CGO that allows us to invoke C code from Go as if it natively co-existed. I wrote a detailed post talking about about real-world integration.

Read it here - https://lnkd.in/geNdxCk4

This was Day #4 of my 30 days of Go challenge, so follow along my journey where I share non-trivial things, performance optimization, and writing efficient code in Go.

⚡ I keep writing and sharing these engineering nuggets, so if you are keen on learning them, follow along.

duggup.com/p/arpit

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses