This is the mail archive of the mailing list for the libffi project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: closure api return value types problem

> Some time ago ghc project[1] switched to libffi to handle
> foreign calls from/to external world. When I tried ghc on
> powerpc64 I got some problems which I believe are result
> of that switch.
> In one of FFI call types ghc uses C code generation and produces
> following code:
> void haskell_closure_called_from_c(
>     void *cif __UNUSED__,
>     void* resp,
>     void** args,
>     void* haskell_runtime)
> {
> HaskellObj ret;
> HsInt32 cret;
> ret = RT_CALL(haskell_runtime(args));
> cret=rts_getInt32(ret);
> *(HsInt32*)resp = cret; /* <- is that corrct code? */
> }

Just looked at cls_ushort.c(and other integrals) test:
  *(ffi_arg*)resp = *(unsigned short *)args[0];
and cls_float.c
   *(float *)resp = *(float *)args[0];

Integrals seem to strangely be casted to 'ffi_arg *'(long *) while FPU ones
are casted to their real type. It's normal (but undocumented) or it's a
horrible inconsistency bug?




Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]