Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fiddle Closure ABI #11

Open
sancarn opened this issue Jun 20, 2018 · 1 comment
Open

Fiddle Closure ABI #11

sancarn opened this issue Jun 20, 2018 · 1 comment

Comments

@sancarn
Copy link

sancarn commented Jun 20, 2018

Include information about what an ABI is in docs regarding Fiddle Closure constructor, perhaps even include definitions below in Fiddle::ABI?

typedef enum ffi_abi {
#if defined(X86_WIN64)
  FFI_FIRST_ABI = 0,
  FFI_WIN64,            /* sizeof(long double) == 8  - microsoft compilers */
  FFI_GNUW64,           /* sizeof(long double) == 16 - GNU compilers */
  FFI_LAST_ABI,
#ifdef __GNUC__
  FFI_DEFAULT_ABI = FFI_GNUW64
#else  
  FFI_DEFAULT_ABI = FFI_WIN64
#endif  

#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
  FFI_FIRST_ABI = 1,
  FFI_UNIX64,
  FFI_WIN64,
  FFI_EFI64 = FFI_WIN64,
  FFI_GNUW64,
  FFI_LAST_ABI,
  FFI_DEFAULT_ABI = FFI_UNIX64

#elif defined(X86_WIN32)
  FFI_FIRST_ABI = 0,
  FFI_SYSV      = 1,
  FFI_STDCALL   = 2,
  FFI_THISCALL  = 3,
  FFI_FASTCALL  = 4,
  FFI_MS_CDECL  = 5,
  FFI_PASCAL    = 6,
  FFI_REGISTER  = 7,
  FFI_LAST_ABI,
  FFI_DEFAULT_ABI = FFI_MS_CDECL
#else
  FFI_FIRST_ABI = 0,
  FFI_SYSV      = 1,
  FFI_THISCALL  = 3,
  FFI_FASTCALL  = 4,
  FFI_STDCALL   = 5,
  FFI_PASCAL    = 6,
  FFI_REGISTER  = 7,
  FFI_MS_CDECL  = 8,
  FFI_LAST_ABI,
  FFI_DEFAULT_ABI = FFI_SYSV
#endif
} ffi_abi;
#endif
@sancarn
Copy link
Author

sancarn commented Jun 20, 2018

That being said I couldn't actually instantiate any other ABIs either, so I guess they aren't implemented in cygwin? Or maybe I'm just using the Closure class incorrectly...?

begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],0);puts 0;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],1);puts 1;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],2);puts 2;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],3);puts 3;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],4);puts 4;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],5);puts 5;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],6);puts 6;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],7);puts 7;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],8);puts 8;rescue;end
begin;Class.new(Fiddle::Closure){}.new(Fiddle::TYPE_VOID, [],9);puts 9;rescue;end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant