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
callbacks from C to ocaml need nested functions where it shouldn't need to #7340
Comments
Comment author: goswin Yes, but that's only have the solution imho. |
Comment author: @ygrek You mean "half of the solution"? |
Comment author: @mshinwell @Goswin Please explain why you think CAMLdrop is insufficient. |
I think Goswin's concern may be that the call to
so it appears that the body of I think |
If compiling with a C90 compiler, the void foo(const char *name) {
caml_leave_blocking_section();
{
CAMLparam0();
CAMLlocal1(_name);
_name = caml_copy_string(name);
caml_callback1(_func, _name);
CAMLdrop;
}
caml_enter_blocking_section();
} |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 7340
Reporter: goswin
Status: feedback (set by @mshinwell on 2016-12-08T07:42:36Z)
Resolution: open
Priority: normal
Severity: feature
Target version: undecided
Category: runtime system and C interface
Bug description
When you have a callback from C to ocaml and support blocking sections then 2 functions are needed over and over again in the same pattern:
There should be a macro
CAMLenter()
that combinescaml_leave_blocking_section();
withCAMLparam0();
and macros
CAMLleave0()
andCAMLleaveT(type, arg)
that combinecaml_enter_blocking_section()
with the respectiveCAMLreturn*
macros.Note: The inner function can never return a value so the equivalent of
CAMLreturn(value)
makes no sense. Should there be aCAMLleave()
that doesn't create a local copy of the return value instead?The text was updated successfully, but these errors were encountered: