I've now made a lot of progress with HaskellDirect. I've built the .so file with one ldap function and I wanted to test it out. I wonder if someone could help a little? Here's the C code I want to reproduce in Haskell. main( int argc, char **argv ) { LDAP *ld; LDAPMessage *result, *e; BerElement *ber; char *a, *dn; char **vals; int i; /* get a handle to an LDAP connection */ if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) { perror( "ldap_init" ); return( 1 ); } HaskellDirect generates the following interface for ldap_init. data LDAP = Ldap ldap_init :: String -> Int32 -> IO LDAP What I'd like to be able to say is: module Main(main) where import Prelude import Ldap import Addr main = do x <- ldap_init "wssun16" 389 if x == nullAddr then putStrLn "Failure" else putStrLn "Success" but obviously I can't because nullAddr isn't of type LDAP. Type checking ERROR "main.hs" (line 8): Type error in application *** Expression : x == nullAddr *** Term : x *** Type : LDAP *** Does not match : Addr If I look in the HaskellDirect example for pcre then somehow the following gets generated sizeofPcre :: Word32 sizeofPcre = sizeofAddr addrToPcre :: Addr -> Pcre addrToPcre v = Pcre v If I had an addrToLDAP function then I could write if x == addrToLDAP nullAddr then ... which would be type correct. So what do I have to write in the .idl or .asf files to get HaskellDirect to generate a function addrToLDAP? Dominic.