calling FunPtr's?

John Meacham john at repetae.net
Fri Oct 17 04:09:33 EDT 2003


I need to call some dynamically linked routines recieved via
Posix.DynamicLinker but am unsure how to do this from haskell. I do not
know the types of the functions I wish to call at compile time so can't
create appropriate foreign import statements. What would be nice is
something like

callFunPtr  :: (Storable a, Storable b) => FunPtr z -> a -> IO b

with a being a tuple if I want to push multiple arguments onto the
stack perhaps.

this function should be straightforward to implement, as it just needs
to place the arguments on the stack in the appropriate fashion and pull
the return value of out the proper register or memory location, but
would obviously be very architecture specific so should be provided by
the compiler. does something like this exist? is there another way to do
this?
        John

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john at foo.net
---------------------------------------------------------------------------


More information about the Haskell mailing list