Next Previous Contents

6.2 Generating COM client stubs

To have HaskellDirect generate a set of stubs that allows you to invoke the methods of a COM component's interfaces from Haskell, you either need to:

If you've got the information in IDL-form, you would then invoke HaskellDirect as follows:

  ihc  -fcom Component.idl -o Component.hs

(And if you've got it in type library form, add --tlb to the command line.)

All being well, the above invocation should generate the file Component.hs containing the Haskell source code that provides the stubs to your component's methods.

If the component has got any binary interfaces (i.e., derived from IUnknown and not via IDispatch) and you intend to use the generated stubs with Hugs, you also need to supply the option --hugs.

If you're using a compiler (i.e., GHC), you then need to compile the generated Haskell source -- see Section Compiling COM clients. If you're using Hugs, you (naturally) don't need to process the Haskell source any further, but in the event your component contained any binary interfaces, you will need to compile up the generated C stubs, see Section Using Hugs for instructions how to do this.

For a worked example of how to compile up and write COM clients in Haskell, have a look at the code in the examples/comcli directory.


Next Previous Contents