Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle callback functions #124

Open
TheFern2 opened this issue Jul 5, 2022 · 2 comments
Open

How to handle callback functions #124

TheFern2 opened this issue Jul 5, 2022 · 2 comments

Comments

@TheFern2
Copy link

TheFern2 commented Jul 5, 2022

What's the recommended way to dealing with callback funcs, any examples of current conversions doing this?


LIB_EXPORT int32_t plc_tag_create_ex(const char *attrib_str, void (*tag_callback_func)(int32_t tag_id, int event, int status, void *userdata), 

@l0rem1psum
Copy link

With the current Go standard library supporting things like cgo.Handle, it is rather simple now to create C callback to Go functions and vice versa (see: https://github.com/golang/go/wiki/cgo#calling-go-functions-from-c).

Is there any plan to add better support for callbacks in the future? @xlab

@TheFern2
Copy link
Author

TheFern2 commented Sep 7, 2023

With the current Go standard library supporting things like cgo.Handle, it is rather simple now to create C callback to Go functions and vice versa (see: https://github.com/golang/go/wiki/cgo#calling-go-functions-from-c).

Is there any plan to add better support for callbacks in the future? @xlab

Dunno if you already know, but I thought to share anyway, this is how I did callbacks on a project. https://github.com/libplctag/goplctag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants