Skip to content

My Go playground that stores test programs and such. Includes tests that imports and uses structures and functions from shared and static C libraries.

Notifications You must be signed in to change notification settings

gamemann/go-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Golang playground that consists of test programs and such.

  • Channels - Go programs that interact with channels.
    • Chan01 - A Go program that reads and writes to a string channel in separate Go routines.
  • Go & C - Go Programs that interface with C via the Cgo package using structures, functions, and more!
    • Basic01 - A Go program that creates and prints a basic C structure (integer and string fields).
    • Basic02 - A Go program that creates a person at the age of 26 and then increases their age to 27 10 seconds later using C structures and functions.
    • Pointer01 - A Go program that creates and retrieves values from a C structure with different types of integer fields/sizes and a string. Also uses functions to retrieve/set fields and allocates the C structure with malloc() so you need to free it inside of the main Go program.
    • Array01 - A Go program that passes people created from a config file to a C function that dynamically allocates memory for each person and returns a separate array of the people passed to the function.
    • Array02 - A Go program that does the exact same thing from Array01. However, in this version, the way dynamic entries are allocated is different and allows you to specify the max entries when retrieving from the Go program via GetPeople().
  • Structures - Go programs that interact with structures.
    • InterfaceToStruct01 - A Go program that converts/casts a field that has the interface{} type to a custom structure.

Building

You may use make to build all Go programs and libraries into the build/ directory. You may also use make clean to cleanup all build files.

Notes

Library Path With Shared C Libraries

For Go programs that utilize shared C libraries, you may need to add build/libs to your LD_LIBRARY_PATH environmental variable.

Credits

About

My Go playground that stores test programs and such. Includes tests that imports and uses structures and functions from shared and static C libraries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published