Specifying source file name & line number when using Toploop.use_input

I would like to invoke Toploop.use_input with a source code string that is extracted from, say, a.ml, line 100. Using Toploop.String _ as its input, however, obscures the source code location because it does not have this ("a.ml", 100) information.
This makes Printexc.record_backtrace true virtually print unusable information.
How can I call toploop with the extra source code location?

Did you try preceding your code with a line number directive, eg #100 "a.ml" ?

Cheers,
Nicolas

1 Like

Wasn’t aware of it. Thanks a lot :slight_smile: