Done. https://caml.inria.fr/mantis/view.php?id=7423 Cheers, Immanuel On Mon, Nov 28, 2016 at 4:50 PM, Gabriel Scherer wrote: > It may make sense to have caml_{failwith,invalid_argument}_value > variants of the exception-raising functions that take a parameter, and > be implemented using caml_raise_with_arg(s) directly instead of > caml_raise_with_string. Could you open a mantis issue or submit a > github pull request to track the question and continue discussion? > > http://caml.inria.fr/mantis/ > https://github.com/ocaml/ocaml/pulls > > On Mon, Nov 28, 2016 at 10:43 AM, David Allsopp > wrote: > > immanuel litzroth wrote: > >> caml_invalid_argument(str) is no return and does not free it's > >> argument. > >> So calling it with a string constructed dynamically will mean it'll > never > >> get freed. > >> I could construct an ocaml string and pass that to caml_raise_with_arg, > >> but I don't seem to be able to get to the caml_exn_Invalid_argument from > >> c. Am I missing something? > > > > Possibly - it's surprising that you want dynamic strings with an > exception such as Invalid_argument which is never supposed to be caught and > similarly with Failure where you shouldn't be matching on the string > argument. > > > > At a push, you can retrieve the Invalid_argument exception from > caml_global_data (see byterun/fail.c), but that is essentially hacking the > runtime to do so... > > > > > > David > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs >