Skip to content

golang example for using go code as library with Callback registration from C code

Notifications You must be signed in to change notification settings

dugoisd/go-callback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Golang Callback Registration from C and execution from Go

Description

this is a simple example used for my personnal GO exploration
this code use a Go software as library ( buildmode=c-shared ).
User Apps (C Code) register a callback function with context.
Go Library will call this callback in a go routine.

compile and test

go build -buildmode=c-shared -o libtest main.go

cd test

gcc -o test main.c -Wl,--whole-archive -L. -l:../libtest -lpthread -Wl,-no-whole-archive

About

golang example for using go code as library with Callback registration from C code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published