[mercury-users] Higher-order calls from foreign code

Ralph Becket rafe at cs.mu.OZ.AU
Wed Aug 3 10:48:45 AEST 2005

Peter Hawkins, Wednesday,  3 August 2005:
> Hi...
> Is there a direct way to make a higher order call from foreign code? I 
> have an MR_Word which contains the address of a closure which takes no 
> arguments and is semidet, and I'd like to call it.

Not directly that I know of, but you could do something like this (see

:- pragma export(invoke_closure(in((pred) is semidet)),

:- pred invoke_closure((pred)::in((pred) is semidet)) is semidet.

invoke_closure(P) :-

and then you can write `invoke_closure(P)' directly in your C code.

-- Ralph
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list