At 2002-07-03 02:57, Malcolm Wallace wrote: >The "proper" way to do it is to write the prototype yourself in a >C header file (or use an existing header), and then use a compiler-specific >mechanism to #include it.
OK I'll do this. >The nhc98 compiler does generate a prototype (ghc does not). However, >although this works quite well in the general case, occasionally the >generated prototype may not be compatible with the real C type of >the function (e.g. it cannot guess the `const' attribute). This might be fixed by creating a ConstPtr type. Class Storable could then be extended: class Storable a where ... constPeekElemOff :: ConstPtr a -> Int -> IO a constPeekByteOff :: ConstPtr a -> Int -> IO a constPeek :: ConstPtr a -> IO a castToConst :: Ptr a -> ConstPtr a castAwayConst :: ConstPtr a -> Ptr a -- possibly unsafe -- Ashley Yakeley, Seattle WA _______________________________________________ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi