[jhc] support for imported doubles/floats?
Mark Wotton
mwotton at gmail.com
Mon Aug 17 19:35:53 EDT 2009
On 18/08/2009, at 8:52 AM, John Meacham wrote:
> 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.
So does that require JHC code changes, or is there a workaround I can
deploy in the code to be compiled?
mark
More information about the jhc
mailing list