A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bytedeco/javacpp-presets/issues/1315 below:

[libffi] remove constant global.ffi.FFI_DEFAUL_ABI and friends and point to platform-specific preset.ffi.FFI_DEFAULT_ABI · Issue #1315 · bytedeco/javacpp-presets · GitHub

Hi, I am using "org.bytedeco" % "libffi-platform" % "3.4.4-1.5.8" (via Scala) on Linux.

I think the enum values:

/** enum ffi_abi */ public static final int // #if defined(X86_WIN64) // #elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) // #elif defined(X86_WIN32) // #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 = 9, FFI_DEFAULT_ABI = FFI_SYSV; // #endif

should be removed, as there platform specific, e.g., the comments still show that in C they were platform-specifically defined via

#ifdef

.

It seems the correct way to go is to use the already defined presets.ffi.FFI_DEFAULT_ABI() methods and friends, which are defined as native and supplied from somewhere else:

public static native @MemberGetter int FFI_FIRST_ABI(); public static native @MemberGetter @Platform(not = "windows", pattern = ".*-x86_64") int FFI_UNIX64(); public static native @MemberGetter @Platform(not = "windows", pattern = ".*-x86_64") int FFI_EFI64(); public static native @MemberGetter @Platform(pattern = ".*-x86_64") int FFI_WIN64(); public static native @MemberGetter @Platform(pattern = ".*-x86_64") int FFI_GNUW64(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_THISCALL(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_FASTCALL(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_STDCALL(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_PASCAL(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_REGISTER(); public static native @MemberGetter @Platform(pattern = ".*-x86") int FFI_MS_CDECL(); public static native @MemberGetter @Platform(pattern = {".*-x86", ".*-arm.*"}) int FFI_SYSV(); public static native @MemberGetter @Platform(pattern = "(?!.*-arm64).*-arm.*") int FFI_VFP(); public static native @MemberGetter @Platform(pattern = ".*-ppc64.*") int FFI_LINUX(); public static native @MemberGetter @Platform(pattern = ".*-ppc64.*") int FFI_LINUX_STRUCT_ALIGN(); public static native @MemberGetter @Platform(pattern = ".*-ppc64.*") int FFI_LINUX_LONG_DOUBLE_128(); public static native @MemberGetter @Platform(pattern = ".*-ppc64.*") int FFI_LINUX_LONG_DOUBLE_IEEE128(); public static native @MemberGetter int FFI_LAST_ABI(); public static native @MemberGetter int FFI_DEFAULT_ABI();

I'm not sure where the native things get their value from, but those have the right value for me.

(I noticed this, because in the current state they are easy to confuse, e.g, when your call the method FFI_DEFAULT_ABI() you get the right value, but when you access the field FFI_DEFAULT_ABI you get the wrong value, and an error later when you try to pass it to prepare. They are even easier to confuse in Scala, where syntactic sugar often allows one to shorten x.f() to x.f.)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4