Dynamically choosing the main function

Harendra Kumar harendra.kumar at gmail.com
Sun Nov 12 16:54:07 UTC 2017


For example, I can easily define entry points for arbitrary functions. At
run time I can choose which entry point to call and benchmark that entry
point using existing performance benchmarking tools like the very powerful
and comprehensive "perf" tool on linux. This provides a very powerful way
to analyze the performance for free and in a convenient manner with little
instrumentation. I do not want the main entry point to be clobbered for
such things. Ideally I would just use a simple annotation for any arbitrary
function to convert it into an entry point that can be chosen at runtime. I
am just giving a general idea here without going into specifics.

-harendra

On 12 November 2017 at 21:58, Shea Levy <shea at shealevy.com> wrote:

> What would you be able to achieve with this that you couldn't achieve
> with branching in a fixed custom main function?
>
> Thanks,
> Shea
>
> Harendra Kumar <harendra.kumar at gmail.com> writes:
>
> > Hi,
> >
> > GHC allows choosing a main function at link time using the "-main-is"
> > option. I was wondering if there is a possibility to choose the main
> > function at runtime. Or even better, if something equivalent to "ghc -e"
> > is somehow possible in a linked binary executable. If not, are there any
> > plans to achieve something like that in future? Are there any
> theoretical,
> > practical obstacles to that?
> >
> > Thanks,
> > Harendra
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20171112/a1cf2fd7/attachment.html>


More information about the ghc-devs mailing list