This is the mail archive of the libffi-discuss@sourceware.org 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]

C99 complex types support


I'm thinking about implementing support for complex types in
libffi.  At the moment some implementations that use libffi emulate
complex types as structs with two fields, but this does not work on
all targets.  Specifically, s390 and s390x are unable to handle
"_Complex float" as structs (or the complex64 type in the Go
language).

In 2007 there was a short discussion about complex:

> > Tom Tromey schrieb:
> > >>>>>> "Thomas" == Thomas Heller <theller@ctypes.org> writes:
> > I would possibly be able to find the official specification how
> > complex types have to be passed for architectures that I have access to
> > AND I'm at least halfway familiar with (x86 and AMD64, maybe G4), but there
> > is no hope I could make a patch for other architectures.  How would that
> > be handled?
> 
> Offhand I don't know.  I guess we could make it an error on
> unsupported platforms somehow.  Perhaps a compile-time error.

I've tried to implement complex support for s390[x] in libffi to
get a feeling how it works.  I could write a patch that adds
FFI_TYPE_COMPLEX (with value 15) that takes one base type as an
argument, and provide implementations for s390[x].

That leaves the question how to handle targets that have not
implemented the new type.

  * Compile time error
  * Runtime assertion if FFI_TYPE_COMPLEX is used
  * Runtime error if FFI_TYPE_COMPLEX is used

I've no real preference here as this choice it won't affect
s390[x], but I could implement error handling for all targets.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany


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