You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your C program has to call at least one Go callback (exported function)
to make sure that the Go runtime will finish initializing before your
program exits. (that's the reason why adding sleep(1) will allow the
message to show)
Go's runtime initialization is async, that is, when dlopen returns, it's not
done yet. It's just started in another thread. You need to call a cgo export
to synchronize with it.
version and OS
What did you do?
I tried to dlopen c-shared go object. Please check sample code below:
main.c
dso.go
comple both as commented top of the code, and try
./a.out ./dso
What did you expect to see?
I expected to see a message and "n: 1". in dlopen(3)
but (my, users) constructor, func init() seems to be defered.
What did you see instead?
It shows "n: 0", I can see the expected by enabling sleep(1), in comment.
The text was updated successfully, but these errors were encountered: