-
Notifications
You must be signed in to change notification settings - Fork 5
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
License for code examples in documentation #11
Comments
TL;DR
Thanks so much for this library, it is very useful. |
The code examples in the documentation are public domain (CC0). When I eventually find the time, I'll make that explicitly clear in a commit. |
Gentle ping :-) |
@fdopen Gentle ping :-) -- please see #11 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are some useful code examples in the documentation, especially regarding static callbacks, for instance.
See https://github.com/fdopen/ppx_cstubs/blob/638b019ab5eb0d8a187710d00414a1d2536e249c/docs/static_callbacks.md
The general algorithm is straightforward: We store the data associated with each closure in a hash table (with function
store_closure
). The hash table is keyed with an automatically incrementing integer. This integer is converted to a raw pointer and given to the C-code when we register the callback. This raw pointer (i.e. integer) is given back to us by the C-code when the OCaml callback is invoked and we can look up the same hash table with it to get the data for the closure (with functionget_closure
).This is great and there are probably not many alternative approaches to implement this algorithm in OCaml in a simpler/nicer way than you have done.
It would greatly appreciated if you can clarify the license the code samples appearing in the documentation fall under, if people want to reuse this
Ideally, the code samples would be under a liberal license/CC0. Interestingly the Ocaml project has recently done this -- see ocaml/ocaml#12097
If sample code is under LGPL too then again one would need to understand if there are any license virality implications since now you would now be using this directly in your code.
To not worry about licensing one could argue that that you could just re-implement this algorithm yourself but it essentially be the sample implementation because there not that many ways of writing the same algorithm in OCaml !
To sidestep all this, I thought it might be better to raise a GitHub issue and request a clarification. This will be useful for everyone who wants to use static callbacks with ppx_cstubs.
The text was updated successfully, but these errors were encountered: