Can I get the internal name of a package at runtime?

Brandon Allbery allbery.b at gmail.com
Sat Oct 14 20:22:15 UTC 2017


Oh, wait, that won;t work because you're trying to find the name of
something to load at runtime. But you can still z-encode the known parts of
the name and look for files starting and ending with those components; the
ABI hash won't matter because a dynamically loaded plugin can't use the
inlinings from the .hi file anyway. If you get multiple matches, you could
warn about it but because you can't use the .hi inlinings in that context
it won't matter which one you load.

On Sat, Oct 14, 2017 at 4:19 PM, Brandon Allbery <allbery.b at gmail.com>
wrote:

> On Sat, Oct 14, 2017 at 3:59 PM, MarLinn <monkleyon at gmail.com> wrote:
>
>> That sounds reasonable, but also like there *can not be* a way to obtain
>> that hash at runtime. And therefore, no way to discover the true package
>> name.
>>
>
> I can think of a hacky way: make sure the symbol table is still present in
> the executable and that you can find said executable, z-encode the part of
> the package+version you know and a symbol you know, and look for symbols
> that start with one and end with the other; the hash will be in between.
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>



-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20171014/f16ad88d/attachment.html>


More information about the ghc-devs mailing list