[m-dev.] for review: fix dl.m for HL grades

Tyson Dowd trd at cs.mu.OZ.AU
Thu Jan 11 15:01:59 AEDT 2001


On 11-Jan-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Estimated hours taken: 3
> 
> extras/dynamic_linking/dl.m:
> 	Fix a bug with the building of closures for the MLDS back-end:
> 	the wrapper procedure in the closure gets passed the closure
> 	as an extra argument, so we can't just use the address return
> 	from dlsym() in the closure.  Instead, we need to put the
> 	address of a wrapper procedure in the closure, and have the
> 	wrapper procedure call the real procedure, passing it all
> 	the arguments passed to the wrapper *except* for the closure
> 	argument.

You should also add the test case (dl_test.m and hello.m) which actually
uses this code.

> +**
> +** XXX This will also fail for calling conventions where the callee pops the
> +** arguments.  To handle that right, we'd need different wrappers for
> +** each different number of arguments.  (Doing that would also be slightly
> +** more efficient, so it may worth doing...)
> +**
> +** There is a library called `ffcall' which we could use
> +** to do this in a more portable manner.

It's called `libffi'

http://sources.redhat.com/libffi/

(unless you found another one).

Otherwise this diff is fine, thanks!

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list