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]

Re: closure api return value types problem


> The "ffi_arg" type is meant to represent the largest integral type held in a register, more or less.  It is assumed that "resp" points to the appropriately-sized memory.
Aha, thanks!

I'd like to clarify more questions for myself:
1. If closure return type is integral - we have always have to use 'ffi_arg' as return:
   Say, closure returning char will be the following:
   *(ffi_arg*)resp = 'z';
   The question is what types are integral? All except float, double and struct?
   How about uint64_t on 32bit platform? Does C platform ABI describe how it should
   be passed from function?

2. Why integral return types (but not argument types) are so special?
   I could imagine platforms, which do not support 'byte store' operations at all
   (or efficiently).
   But then argument parameters could be handled the same way:
      uchar arg1  = (uchar)*(ffi_arg*)arg[0];
   instead of current
      uchar arg1  = *(uchar*)arg[0];
   Was it the reason to treat returns in such a strange way?

Please tell if my questions are unclear . I'd really like to get answers and propose
explainig patch for documentation.

Thanks!

-- 

  Sergei

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]