Next Previous Contents

4.2 Code addresses

The foreign import declaration allows us to invoke an external function by name from within the comforts of the Haskell world, while foreign import dynamic lets us invoke an external function by address. However, there's no way of getting at the code address of some particular external label though, which is at times useful, e.g. for the construction of method tables for, say, Haskell COM components. To support this, the FFI has got foreign labels:

foreign label "freeAtLast" addrOf_freeAtLast :: Addr

The meaning of this declaration is that addrOf_freeAtLast will now contain the address of the label freeAtLast.


Next Previous Contents