Version française
Home     About     Download     Resources     Contact us    
Browse thread
Name of currently executing function
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Benjamin <dave@r...>
Subject: Name of currently executing function
Hello,

Is there any way to find out the name of the currently executing 
function from within an OCaml program? I guess, technically, I'm 
interested in the grandparent. Something that would allow this:

let log msg =
   Printf.eprintf "%s: %s\n%!"
     (get_caller_function_name ())
     msg

I'm guessing the above is not possible, but perhaps there's some way to 
accomplish this using some combination of camlp4, back traces, 
profiling, or debugging?

Thanks,
Dave