[jhc] support for imported doubles/floats?

John Meacham john at repetae.net
Mon Aug 17 18:52:03 EDT 2009


On Sun, Aug 16, 2009 at 05:34:54PM +1000, Mark Wotton wrote:
> maybe a known issue, but I can't seem to import functions involving C  
> floats or doubles:
>
> 17:33[1] ~ % cat RubyMap.hs
> {-# LANGUAGE ForeignFunctionInterface #-}
> import Foreign.C.Types	
> foreign import ccall unsafe "foo.h somedub" somedub :: CDouble
> 17:33 ~ % ~/src/jhc/jhc RubyMap.hs
> jhc RubyMap.hs
> jhc 0.6.2 (-n krasyupheasy-5
> )
> Finding Dependencies...
> Using Ho Cache: '/Users/mwotton/.jhc/cache'
> Loading libraries: ["base","haskell98"]
> Library: base-1.0        </usr/local/share/jhc-0.6/base-1.0.hl>
> Library: haskell98-1.0   </usr/local/share/jhc-0.6/haskell98-1.0.hl>
> RubyMap.hs:1   - Warning: The pragma 'LANGUAGE' is unknown
> Main                    [RubyMap.hs]
> Typechecking...
> [1 of 1] Main              
> (.............................................)
> Compiling...
> [1 of 1] Main             user error (lookupExtTypeInfo: (ELit  
> (Foreign.C.Types.CDouble::ESort *),ELit (Foreign.C.Types.CDouble::ESort 
> *)))
>
>
> if this is spamming, please let me know and i'll stop, but I'd really  
> like to be able to use JHC in Hubris.

No, All this feedback is great! Feedback about what isn't working is one
of the most useful things, working on a project alone, it is too easy to
forget to test the things you forgot to implement :) (Like the
marshalling of CDouble). 

Actually in jhc, it is guarenteed that Double and Float marshall to the
C 'double' and 'float' types repsectively, so using those is probably
fine for now. Some of the numeric types arn't filled out beacuse
'newtype deriving' would make doing so a lot nicer (and more efficient)
and it isn't working in jhc yet.

Sorry I didn't respond sooner, I was away from the computer for the
weekend.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the jhc mailing list