
Hi all, I'm trying to use the 'plugins' package. Since I already posted to stackoverflow I'll just link to that. I posted a simple program that I thought would work, but mostly doesn't. Any pointers, appreciated. http://stackoverflow.com/questions/5427777/help-with-haskell-dynamic-plugin-... thanks, Rob

On 26 March 2011 05:57, Rob Nikander
I'm trying to use the 'plugins' package. Since I already posted to stackoverflow I'll just link to that. I posted a simple program that I thought would work, but mostly doesn't. Any pointers, appreciated.
http://stackoverflow.com/questions/5427777/help-with-haskell-dynamic-plugin-...
Hi Rob, I don't have a stack overflow account, so I will give a partial answer here. I'm not sure what the issue is with runhaskell, but you are getting a segfault with dynload. The comments on dynload in the source of the plugins package reveal the probable cause: \begin{comment} -- A work-around for Dynamics. The keys used to compare two TypeReps are -- somehow not equal for the same type in hs-plugin's loaded objects. -- Solution: implement our own dynamics... -- -- The problem with dynload is that it requires the plugin to export -- a value that is a Dynamic (in our case a (TypeRep,a) pair). If this -- is not the case, we core dump. Use pdynload if you don't trust the -- user to supply you with a Dynamic \end{comment} So it seems that, to use dynload, you must export a pair containing a typerep and a value, rather than just a value. Plugins also provides pdynload, which is apparently a "super-replacement for dynload", though I didn't look into it in detail. Cheers, Bernie.

On Fri, Mar 25, 2011 at 9:52 PM, Bernie Pope
On 26 March 2011 05:57, Rob Nikander
wrote:
\begin{comment} -- A work-around for Dynamics. The keys used to compare two TypeReps are -- somehow not equal for the same type in hs-plugin's loaded objects. -- Solution: implement our own dynamics... -- -- The problem with dynload is that it requires the plugin to export -- a value that is a Dynamic (in our case a (TypeRep,a) pair). If this -- is not the case, we core dump. Use pdynload if you don't trust the -- user to supply you with a Dynamic \end{comment}
Thanks, after playing with that I've got something working. Though I'd still need to dynamically link this thing, because the default behavior is to take 30 seconds to compile and link a 58 MB executable. Not good during development. I've reported a bug for the runhaskell case [1], since it gives me a message about "strange closure type 894" and says "Please report this as a GHC bug". Rob [1] http://hackage.haskell.org/trac/ghc/ticket/5053
participants (2)
-
Bernie Pope
-
Rob Nikander