# Interacting between C libraries and Go using Unsafe

DevFeed: [Interacting between C libraries and Go using Unsafe](<https://devfeed.tech/articles/interacting-between-c-libraries-and-go-using-unsafe-39615.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2020-06-11_Interacting-between-C-libraries-and-Go-using-Unsafe-cb8b460d4f0c>)

Published: 2020-06-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [go](<https://devfeed.tech/tags/go.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [system-programming](<https://devfeed.tech/tags/system-programming.md>)

## AI overview

This tutorial explains how to reuse C library data structures and methods from Go using the unsafe package. It discusses differences between C and Go memory management, converting C strings and pointers, and casting C data into corresponding Go structures.

## Source excerpt

Suppose we have a C lib where we have defined various data structures and methods. Due to some reason or constraint, there needs to be a Golang process which has to reuse the structures mentioned in the C lib...