├── .gitignore ├── Demo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── sunnyxx.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── sunnyxx.xcuserdatad │ └── xcschemes │ ├── Demo.xcscheme │ └── xcschememanagement.plist ├── Demo.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── sunnyxx.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── Demo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ └── libffi-iOS │ │ │ ├── ffi.h │ │ │ ├── ffi_arm.h │ │ │ ├── ffi_arm64.h │ │ │ ├── ffi_common.h │ │ │ ├── ffi_i386.h │ │ │ ├── ffi_x86_64.h │ │ │ ├── ffitarget.h │ │ │ ├── ffitarget_arm.h │ │ │ ├── ffitarget_arm64.h │ │ │ ├── ffitarget_i386.h │ │ │ └── ffitarget_x86_64.h │ └── Public │ │ └── libffi-iOS │ │ ├── ffi.h │ │ ├── ffi_arm.h │ │ ├── ffi_arm64.h │ │ ├── ffi_common.h │ │ ├── ffi_i386.h │ │ ├── ffi_x86_64.h │ │ ├── ffitarget.h │ │ ├── ffitarget_arm.h │ │ ├── ffitarget_arm64.h │ │ ├── ffitarget_i386.h │ │ └── ffitarget_x86_64.h ├── Local Podspecs │ └── libffi-iOS.podspec.json ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── sunnyxx.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── Target Support Files │ └── Pods-Demo │ ├── Pods-Demo-acknowledgements.markdown │ ├── Pods-Demo-acknowledgements.plist │ ├── Pods-Demo-dummy.m │ ├── Pods-Demo-frameworks.sh │ ├── Pods-Demo-resources.sh │ ├── Pods-Demo.debug.xcconfig │ └── Pods-Demo.release.xcconfig ├── README.md ├── libffi-iOS.podspec └── libffi ├── ffi.h ├── ffi_arm.h ├── ffi_arm64.h ├── ffi_common.h ├── ffi_i386.h ├── ffi_x86_64.h ├── ffitarget.h ├── ffitarget_arm.h ├── ffitarget_arm64.h ├── ffitarget_i386.h ├── ffitarget_x86_64.h └── libffi.a /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnyxx/libffi-iOS/c99de7586d22b9b35100d098a37ed42cb75e26dc/.gitignore -------------------------------------------------------------------------------- /Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 487706DA1E8A2FA300DEF294 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 487706D91E8A2FA300DEF294 /* main.m */; }; 11 | 487706DD1E8A2FA300DEF294 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 487706DC1E8A2FA300DEF294 /* AppDelegate.m */; }; 12 | 487706E01E8A2FA300DEF294 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 487706DF1E8A2FA300DEF294 /* ViewController.m */; }; 13 | 487706E31E8A2FA300DEF294 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 487706E11E8A2FA300DEF294 /* Main.storyboard */; }; 14 | 487706E51E8A2FA300DEF294 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 487706E41E8A2FA300DEF294 /* Assets.xcassets */; }; 15 | 487706E81E8A2FA300DEF294 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 487706E61E8A2FA300DEF294 /* LaunchScreen.storyboard */; }; 16 | EF000F406C384D36683C70E5 /* libPods-Demo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 30FA0F7A3455CDE7AF953541 /* libPods-Demo.a */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 2579A26E0C051123CADBFDB0 /* Pods-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig"; sourceTree = ""; }; 21 | 30FA0F7A3455CDE7AF953541 /* libPods-Demo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Demo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 487706D51E8A2FA300DEF294 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 487706D91E8A2FA300DEF294 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | 487706DB1E8A2FA300DEF294 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | 487706DC1E8A2FA300DEF294 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | 487706DE1E8A2FA300DEF294 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | 487706DF1E8A2FA300DEF294 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 28 | 487706E21E8A2FA300DEF294 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 487706E41E8A2FA300DEF294 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 487706E71E8A2FA300DEF294 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 487706E91E8A2FA300DEF294 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 558E814E06B4E60010607586 /* Pods-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig"; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 487706D21E8A2FA300DEF294 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | EF000F406C384D36683C70E5 /* libPods-Demo.a in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 487706CC1E8A2FA300DEF294 = { 48 | isa = PBXGroup; 49 | children = ( 50 | 487706D71E8A2FA300DEF294 /* Demo */, 51 | 487706D61E8A2FA300DEF294 /* Products */, 52 | EA1F7B335D4E040224320273 /* Pods */, 53 | 6919A7A0EC1A1A5F75D9E58B /* Frameworks */, 54 | ); 55 | sourceTree = ""; 56 | }; 57 | 487706D61E8A2FA300DEF294 /* Products */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 487706D51E8A2FA300DEF294 /* Demo.app */, 61 | ); 62 | name = Products; 63 | sourceTree = ""; 64 | }; 65 | 487706D71E8A2FA300DEF294 /* Demo */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 487706DB1E8A2FA300DEF294 /* AppDelegate.h */, 69 | 487706DC1E8A2FA300DEF294 /* AppDelegate.m */, 70 | 487706DE1E8A2FA300DEF294 /* ViewController.h */, 71 | 487706DF1E8A2FA300DEF294 /* ViewController.m */, 72 | 487706E11E8A2FA300DEF294 /* Main.storyboard */, 73 | 487706E41E8A2FA300DEF294 /* Assets.xcassets */, 74 | 487706E61E8A2FA300DEF294 /* LaunchScreen.storyboard */, 75 | 487706E91E8A2FA300DEF294 /* Info.plist */, 76 | 487706D81E8A2FA300DEF294 /* Supporting Files */, 77 | ); 78 | path = Demo; 79 | sourceTree = ""; 80 | }; 81 | 487706D81E8A2FA300DEF294 /* Supporting Files */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 487706D91E8A2FA300DEF294 /* main.m */, 85 | ); 86 | name = "Supporting Files"; 87 | sourceTree = ""; 88 | }; 89 | 6919A7A0EC1A1A5F75D9E58B /* Frameworks */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 30FA0F7A3455CDE7AF953541 /* libPods-Demo.a */, 93 | ); 94 | name = Frameworks; 95 | sourceTree = ""; 96 | }; 97 | EA1F7B335D4E040224320273 /* Pods */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 558E814E06B4E60010607586 /* Pods-Demo.debug.xcconfig */, 101 | 2579A26E0C051123CADBFDB0 /* Pods-Demo.release.xcconfig */, 102 | ); 103 | name = Pods; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 487706D41E8A2FA300DEF294 /* Demo */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 487706EC1E8A2FA300DEF294 /* Build configuration list for PBXNativeTarget "Demo" */; 112 | buildPhases = ( 113 | 1503E7169DBDA67EFA5A2337 /* [CP] Check Pods Manifest.lock */, 114 | 487706D11E8A2FA300DEF294 /* Sources */, 115 | 487706D21E8A2FA300DEF294 /* Frameworks */, 116 | 487706D31E8A2FA300DEF294 /* Resources */, 117 | D94101AE2B72BDDF7233833B /* [CP] Embed Pods Frameworks */, 118 | 7442A0B1379CB63831243EBB /* [CP] Copy Pods Resources */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = Demo; 125 | productName = Demo; 126 | productReference = 487706D51E8A2FA300DEF294 /* Demo.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | 487706CD1E8A2FA300DEF294 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastUpgradeCheck = 0820; 136 | ORGANIZATIONNAME = sunnyxx; 137 | TargetAttributes = { 138 | 487706D41E8A2FA300DEF294 = { 139 | CreatedOnToolsVersion = 8.2; 140 | ProvisioningStyle = Automatic; 141 | }; 142 | }; 143 | }; 144 | buildConfigurationList = 487706D01E8A2FA300DEF294 /* Build configuration list for PBXProject "Demo" */; 145 | compatibilityVersion = "Xcode 3.2"; 146 | developmentRegion = English; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | en, 150 | Base, 151 | ); 152 | mainGroup = 487706CC1E8A2FA300DEF294; 153 | productRefGroup = 487706D61E8A2FA300DEF294 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 487706D41E8A2FA300DEF294 /* Demo */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 487706D31E8A2FA300DEF294 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 487706E81E8A2FA300DEF294 /* LaunchScreen.storyboard in Resources */, 168 | 487706E51E8A2FA300DEF294 /* Assets.xcassets in Resources */, 169 | 487706E31E8A2FA300DEF294 /* Main.storyboard in Resources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXResourcesBuildPhase section */ 174 | 175 | /* Begin PBXShellScriptBuildPhase section */ 176 | 1503E7169DBDA67EFA5A2337 /* [CP] Check Pods Manifest.lock */ = { 177 | isa = PBXShellScriptBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | ); 181 | inputPaths = ( 182 | ); 183 | name = "[CP] Check Pods Manifest.lock"; 184 | outputPaths = ( 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 189 | showEnvVarsInLog = 0; 190 | }; 191 | 7442A0B1379CB63831243EBB /* [CP] Copy Pods Resources */ = { 192 | isa = PBXShellScriptBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | inputPaths = ( 197 | ); 198 | name = "[CP] Copy Pods Resources"; 199 | outputPaths = ( 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | shellPath = /bin/sh; 203 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-resources.sh\"\n"; 204 | showEnvVarsInLog = 0; 205 | }; 206 | D94101AE2B72BDDF7233833B /* [CP] Embed Pods Frameworks */ = { 207 | isa = PBXShellScriptBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | inputPaths = ( 212 | ); 213 | name = "[CP] Embed Pods Frameworks"; 214 | outputPaths = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | shellPath = /bin/sh; 218 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh\"\n"; 219 | showEnvVarsInLog = 0; 220 | }; 221 | /* End PBXShellScriptBuildPhase section */ 222 | 223 | /* Begin PBXSourcesBuildPhase section */ 224 | 487706D11E8A2FA300DEF294 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 487706E01E8A2FA300DEF294 /* ViewController.m in Sources */, 229 | 487706DD1E8A2FA300DEF294 /* AppDelegate.m in Sources */, 230 | 487706DA1E8A2FA300DEF294 /* main.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 487706E11E8A2FA300DEF294 /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 487706E21E8A2FA300DEF294 /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 487706E61E8A2FA300DEF294 /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 487706E71E8A2FA300DEF294 /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 487706EA1E8A2FA300DEF294 /* Debug */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_ANALYZER_NONNULL = YES; 261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 262 | CLANG_CXX_LIBRARY = "libc++"; 263 | CLANG_ENABLE_MODULES = YES; 264 | CLANG_ENABLE_OBJC_ARC = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_CONSTANT_CONVERSION = YES; 267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 268 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INFINITE_RECURSION = YES; 272 | CLANG_WARN_INT_CONVERSION = YES; 273 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 274 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = dwarf; 280 | ENABLE_STRICT_OBJC_MSGSEND = YES; 281 | ENABLE_TESTABILITY = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu99; 283 | GCC_DYNAMIC_NO_PIC = NO; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_OPTIMIZATION_LEVEL = 0; 286 | GCC_PREPROCESSOR_DEFINITIONS = ( 287 | "DEBUG=1", 288 | "$(inherited)", 289 | ); 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 297 | MTL_ENABLE_DEBUG_INFO = YES; 298 | ONLY_ACTIVE_ARCH = YES; 299 | SDKROOT = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | }; 302 | name = Debug; 303 | }; 304 | 487706EB1E8A2FA300DEF294 /* Release */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_ANALYZER_NONNULL = YES; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 316 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 323 | CLANG_WARN_UNREACHABLE_CODE = YES; 324 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 325 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 326 | COPY_PHASE_STRIP = NO; 327 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 328 | ENABLE_NS_ASSERTIONS = NO; 329 | ENABLE_STRICT_OBJC_MSGSEND = YES; 330 | GCC_C_LANGUAGE_STANDARD = gnu99; 331 | GCC_NO_COMMON_BLOCKS = YES; 332 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 333 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 334 | GCC_WARN_UNDECLARED_SELECTOR = YES; 335 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 336 | GCC_WARN_UNUSED_FUNCTION = YES; 337 | GCC_WARN_UNUSED_VARIABLE = YES; 338 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 339 | MTL_ENABLE_DEBUG_INFO = NO; 340 | SDKROOT = iphoneos; 341 | TARGETED_DEVICE_FAMILY = "1,2"; 342 | VALIDATE_PRODUCT = YES; 343 | }; 344 | name = Release; 345 | }; 346 | 487706ED1E8A2FA300DEF294 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | baseConfigurationReference = 558E814E06B4E60010607586 /* Pods-Demo.debug.xcconfig */; 349 | buildSettings = { 350 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 351 | INFOPLIST_FILE = Demo/Info.plist; 352 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 353 | PRODUCT_BUNDLE_IDENTIFIER = sunnyxx.Demo; 354 | PRODUCT_NAME = "$(TARGET_NAME)"; 355 | }; 356 | name = Debug; 357 | }; 358 | 487706EE1E8A2FA300DEF294 /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | baseConfigurationReference = 2579A26E0C051123CADBFDB0 /* Pods-Demo.release.xcconfig */; 361 | buildSettings = { 362 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 363 | INFOPLIST_FILE = Demo/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 365 | PRODUCT_BUNDLE_IDENTIFIER = sunnyxx.Demo; 366 | PRODUCT_NAME = "$(TARGET_NAME)"; 367 | }; 368 | name = Release; 369 | }; 370 | /* End XCBuildConfiguration section */ 371 | 372 | /* Begin XCConfigurationList section */ 373 | 487706D01E8A2FA300DEF294 /* Build configuration list for PBXProject "Demo" */ = { 374 | isa = XCConfigurationList; 375 | buildConfigurations = ( 376 | 487706EA1E8A2FA300DEF294 /* Debug */, 377 | 487706EB1E8A2FA300DEF294 /* Release */, 378 | ); 379 | defaultConfigurationIsVisible = 0; 380 | defaultConfigurationName = Release; 381 | }; 382 | 487706EC1E8A2FA300DEF294 /* Build configuration list for PBXNativeTarget "Demo" */ = { 383 | isa = XCConfigurationList; 384 | buildConfigurations = ( 385 | 487706ED1E8A2FA300DEF294 /* Debug */, 386 | 487706EE1E8A2FA300DEF294 /* Release */, 387 | ); 388 | defaultConfigurationIsVisible = 0; 389 | }; 390 | /* End XCConfigurationList section */ 391 | }; 392 | rootObject = 487706CD1E8A2FA300DEF294 /* Project object */; 393 | } 394 | -------------------------------------------------------------------------------- /Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo.xcodeproj/project.xcworkspace/xcuserdata/sunnyxx.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnyxx/libffi-iOS/c99de7586d22b9b35100d098a37ed42cb75e26dc/Demo.xcodeproj/project.xcworkspace/xcuserdata/sunnyxx.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo.xcodeproj/xcuserdata/sunnyxx.xcuserdatad/xcschemes/Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Demo.xcodeproj/xcuserdata/sunnyxx.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Demo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 487706D41E8A2FA300DEF294 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Demo.xcworkspace/xcuserdata/sunnyxx.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnyxx/libffi-iOS/c99de7586d22b9b35100d098a37ed42cb75e26dc/Demo.xcworkspace/xcuserdata/sunnyxx.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Demo 4 | // 5 | // Created by sunnyxx on 2017/3/28. 6 | // Copyright © 2017年 sunnyxx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Demo 4 | // 5 | // Created by sunnyxx on 2017/3/28. 6 | // Copyright © 2017年 sunnyxx. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Demo 4 | // 5 | // Created by sunnyxx on 2017/3/28. 6 | // Copyright © 2017年 sunnyxx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Demo 4 | // 5 | // Created by sunnyxx on 2017/3/28. 6 | // Copyright © 2017年 sunnyxx. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import 12 | 13 | @interface Sark : NSObject 14 | @end 15 | 16 | @implementation Sark 17 | 18 | - (int)fooWithBar:(int)bar baz:(int)baz { 19 | return bar + baz; 20 | } 21 | 22 | @end 23 | 24 | void testFFICall() { 25 | ffi_cif cif; 26 | ffi_type *argumentTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint32, &ffi_type_sint32}; 27 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_pointer, argumentTypes); 28 | 29 | Sark *sark = [Sark new]; 30 | SEL selector = @selector(fooWithBar:baz:); 31 | int bar = 123; 32 | int baz = 456; 33 | void *arguments[] = {&sark, &selector, &bar, &baz}; 34 | 35 | IMP imp = [sark methodForSelector:selector]; 36 | 37 | int retValue; 38 | ffi_call(&cif, imp, &retValue, arguments); 39 | NSLog(@"ffi_call: %d", retValue); 40 | } 41 | 42 | void closureCalled(ffi_cif *cif, void *ret, void **args, void *userdata) { 43 | int bar = *((int *)args[2]); 44 | int baz = *((int *)args[3]); 45 | *((int *)ret) = bar * baz; 46 | } 47 | 48 | void testFFIClosure() { 49 | ffi_cif cif; 50 | ffi_type *argumentTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint32, &ffi_type_sint32}; 51 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_pointer, argumentTypes); 52 | IMP newIMP; 53 | ffi_closure *closure = ffi_closure_alloc(sizeof(ffi_closure), (void *)&newIMP); 54 | ffi_prep_closure_loc(closure, &cif, closureCalled, NULL, NULL); 55 | 56 | Method method = class_getInstanceMethod([Sark class], @selector(fooWithBar:baz:)); 57 | method_setImplementation(method, newIMP); 58 | 59 | // after hook 60 | Sark *sark = [Sark new]; 61 | int ret = [sark fooWithBar:123 baz:456]; 62 | NSLog(@"ffi_closure: %d", ret); 63 | } 64 | 65 | @interface ViewController () 66 | 67 | @end 68 | 69 | @implementation ViewController 70 | 71 | - (void)viewDidLoad { 72 | [super viewDidLoad]; 73 | // test call 74 | testFFICall(); 75 | // test closure 76 | testFFIClosure(); 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo 4 | // 5 | // Created by sunnyxx on 2017/3/28. 6 | // Copyright © 2017年 sunnyxx. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Yuan Sun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Demo' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for Demo 9 | pod 'libffi-iOS', :path => "./libffi-iOS.podspec" 10 | end 11 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - libffi-iOS (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - libffi-iOS (from `./libffi-iOS.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | libffi-iOS: 9 | :path: "./libffi-iOS.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | libffi-iOS: ef078b4e497e971a867114acc56e89c5cd85c45a 13 | 14 | PODFILE CHECKSUM: 2a2ff96ac803bffa2f7ed6d40eadbde7627d27e5 15 | 16 | COCOAPODS: 1.2.0 17 | -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi_arm.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_arm.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi_common.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_common.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi_i386.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffi_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffitarget.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffitarget_arm.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_arm.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/libffi-iOS/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi_arm.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_arm.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi_common.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_common.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi_i386.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffi_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffi_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffitarget.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffitarget_arm.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_arm.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Public/libffi-iOS/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../../libffi/ffitarget_x86_64.h -------------------------------------------------------------------------------- /Pods/Local Podspecs/libffi-iOS.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "libffi-iOS", 3 | "version": "1.0.0", 4 | "summary": "Stable libffi library for iOS (i386, x86_64, armv7, arm64) which has been fully verified.", 5 | "description": "libffi-iOS is built based on libffi-3.2.1, provides universal library\n(i386, x86_64, armv7, arm64), both ffi_call and ffi_closure are fully\ntested.\nhttps://github.com/sunnyxx/libffi-iOS\nby sunnyxx", 6 | "platforms": { 7 | "ios": "6.0" 8 | }, 9 | "homepage": "https://github.com/sunnyxx/libffi-iOS", 10 | "license": { 11 | "type": "MIT", 12 | "file": "LICENSE" 13 | }, 14 | "authors": { 15 | "sunnyxx": "sunyuan1713@gmail.com" 16 | }, 17 | "source": { 18 | "git": "https://github.com/sunnyxx/libffi-iOS.git", 19 | "tag": "1.0.0" 20 | }, 21 | "vendored_libraries": "libffi/libffi.a", 22 | "source_files": "libffi/*.h" 23 | } 24 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - libffi-iOS (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - libffi-iOS (from `./libffi-iOS.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | libffi-iOS: 9 | :path: "./libffi-iOS.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | libffi-iOS: ef078b4e497e971a867114acc56e89c5cd85c45a 13 | 14 | PODFILE CHECKSUM: 2a2ff96ac803bffa2f7ed6d40eadbde7627d27e5 15 | 16 | COCOAPODS: 1.2.0 17 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2955B06122271DB851399B082195174C /* Pods-Demo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA944E1D5D966DBCA7EB7C661855A95 /* Pods-Demo-dummy.m */; }; 11 | 8D0833EA174471F5DBBDE1A769A552E5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXFileReference section */ 15 | 0AA4CC1D789DA2783447C62D0F699C77 /* Pods-Demo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Demo-acknowledgements.plist"; sourceTree = ""; }; 16 | 1B9BC426BAAE22535A9F70E1A5222A44 /* ffi_arm64.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi_arm64.h; sourceTree = ""; }; 17 | 22418EF3FFE1F2549B5141B63B8557AC /* ffitarget_arm.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm.h; sourceTree = ""; }; 18 | 23E5EACA3EEDD5A79AAA45A04A1397FC /* ffi_arm.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi_arm.h; sourceTree = ""; }; 19 | 3241438CF2C891DB852192E3346409CD /* libffi.a */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = archive.ar; name = libffi.a; path = libffi/libffi.a; sourceTree = ""; }; 20 | 42A2C4B37852C11CD68F3531A75F660C /* libPods-Demo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-Demo.a"; path = "libPods-Demo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 59D9B232ADA6F44D6F9E072636665799 /* ffi_common.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; 22 | 6F5DD532ECDA969984034D51B0F56454 /* Pods-Demo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Demo-acknowledgements.markdown"; sourceTree = ""; }; 23 | 7368E80E3DF60D88AB11F3F541AAF98F /* ffitarget_i386.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; 24 | 7E61E2F2E514A86FEC211F0AD10D8AC1 /* Pods-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Demo.debug.xcconfig"; sourceTree = ""; }; 25 | 8BEC6575609E12DD141C2EFD4E3C7F4B /* ffi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; 26 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 27 | B39A00370FBD494F125F357AC044D3D6 /* ffitarget.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; 28 | B73D0BE296D6A8860F671D918733AC31 /* ffitarget_arm64.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm64.h; sourceTree = ""; }; 29 | BA98EAACDAFB971DF9EDCF9DEA28BE22 /* Pods-Demo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Demo-frameworks.sh"; sourceTree = ""; }; 30 | BC6F318B8C726435B2FF8566E7AC50B9 /* Pods-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Demo.release.xcconfig"; sourceTree = ""; }; 31 | C7D4FCB7261AB58D0CABB229C3FF897D /* ffitarget_x86_64.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = ""; }; 32 | CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 33 | CD8F2BD223A2B65D543AC16402AFA274 /* ffi_x86_64.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = ""; }; 34 | D25544B348B28F2BBA3D9053B844D7D4 /* Pods-Demo-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Demo-resources.sh"; sourceTree = ""; }; 35 | DCA944E1D5D966DBCA7EB7C661855A95 /* Pods-Demo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Demo-dummy.m"; sourceTree = ""; }; 36 | FC6616B1112119D3FBE004E6FBD4D17F /* ffi_i386.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 5F6DD2F8F1B98D27E6EA71C558118DB0 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | 8D0833EA174471F5DBBDE1A769A552E5 /* Foundation.framework in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 097FD64232B27AEF6A1E7D042A7AA59F /* libffi-iOS */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | A2A8B9ED3059C3D6618922A45D91E020 /* Frameworks */, 55 | 2B5F00208D15750DA9A97EB0C6AD097F /* libffi */, 56 | ); 57 | name = "libffi-iOS"; 58 | path = ..; 59 | sourceTree = ""; 60 | }; 61 | 105A24935BC6A33BE66754CE51C36C31 /* Pods-Demo */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 6F5DD532ECDA969984034D51B0F56454 /* Pods-Demo-acknowledgements.markdown */, 65 | 0AA4CC1D789DA2783447C62D0F699C77 /* Pods-Demo-acknowledgements.plist */, 66 | DCA944E1D5D966DBCA7EB7C661855A95 /* Pods-Demo-dummy.m */, 67 | BA98EAACDAFB971DF9EDCF9DEA28BE22 /* Pods-Demo-frameworks.sh */, 68 | D25544B348B28F2BBA3D9053B844D7D4 /* Pods-Demo-resources.sh */, 69 | 7E61E2F2E514A86FEC211F0AD10D8AC1 /* Pods-Demo.debug.xcconfig */, 70 | BC6F318B8C726435B2FF8566E7AC50B9 /* Pods-Demo.release.xcconfig */, 71 | ); 72 | name = "Pods-Demo"; 73 | path = "Target Support Files/Pods-Demo"; 74 | sourceTree = ""; 75 | }; 76 | 140C2C20FDD07F1253EB6E7CF0E6C54D /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 42A2C4B37852C11CD68F3531A75F660C /* libPods-Demo.a */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | 2B5F00208D15750DA9A97EB0C6AD097F /* libffi */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 8BEC6575609E12DD141C2EFD4E3C7F4B /* ffi.h */, 88 | 23E5EACA3EEDD5A79AAA45A04A1397FC /* ffi_arm.h */, 89 | 1B9BC426BAAE22535A9F70E1A5222A44 /* ffi_arm64.h */, 90 | 59D9B232ADA6F44D6F9E072636665799 /* ffi_common.h */, 91 | FC6616B1112119D3FBE004E6FBD4D17F /* ffi_i386.h */, 92 | CD8F2BD223A2B65D543AC16402AFA274 /* ffi_x86_64.h */, 93 | B39A00370FBD494F125F357AC044D3D6 /* ffitarget.h */, 94 | 22418EF3FFE1F2549B5141B63B8557AC /* ffitarget_arm.h */, 95 | B73D0BE296D6A8860F671D918733AC31 /* ffitarget_arm64.h */, 96 | 7368E80E3DF60D88AB11F3F541AAF98F /* ffitarget_i386.h */, 97 | C7D4FCB7261AB58D0CABB229C3FF897D /* ffitarget_x86_64.h */, 98 | ); 99 | name = libffi; 100 | path = libffi; 101 | sourceTree = ""; 102 | }; 103 | 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */, 107 | ); 108 | name = iOS; 109 | sourceTree = ""; 110 | }; 111 | 7DB346D0F39D3F0E887471402A8071AB = { 112 | isa = PBXGroup; 113 | children = ( 114 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 115 | 9BA0A9151033409404099D60391F8290 /* Development Pods */, 116 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 117 | 140C2C20FDD07F1253EB6E7CF0E6C54D /* Products */, 118 | F64792801741A31D953EA71E1A34CBCA /* Targets Support Files */, 119 | ); 120 | sourceTree = ""; 121 | }; 122 | 9BA0A9151033409404099D60391F8290 /* Development Pods */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 097FD64232B27AEF6A1E7D042A7AA59F /* libffi-iOS */, 126 | ); 127 | name = "Development Pods"; 128 | sourceTree = ""; 129 | }; 130 | A2A8B9ED3059C3D6618922A45D91E020 /* Frameworks */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 3241438CF2C891DB852192E3346409CD /* libffi.a */, 134 | ); 135 | name = Frameworks; 136 | sourceTree = ""; 137 | }; 138 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */, 142 | ); 143 | name = Frameworks; 144 | sourceTree = ""; 145 | }; 146 | F64792801741A31D953EA71E1A34CBCA /* Targets Support Files */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 105A24935BC6A33BE66754CE51C36C31 /* Pods-Demo */, 150 | ); 151 | name = "Targets Support Files"; 152 | sourceTree = ""; 153 | }; 154 | /* End PBXGroup section */ 155 | 156 | /* Begin PBXNativeTarget section */ 157 | 68FA21B5083A3B1146FB619FAD9C8C82 /* Pods-Demo */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 8933D2A7BAEE21623B516A196784C4F3 /* Build configuration list for PBXNativeTarget "Pods-Demo" */; 160 | buildPhases = ( 161 | 2A2D7772BFD94AFEA88CFD1466E4C45C /* Sources */, 162 | 5F6DD2F8F1B98D27E6EA71C558118DB0 /* Frameworks */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = "Pods-Demo"; 169 | productName = "Pods-Demo"; 170 | productReference = 42A2C4B37852C11CD68F3531A75F660C /* libPods-Demo.a */; 171 | productType = "com.apple.product-type.library.static"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastSwiftUpdateCheck = 0730; 180 | LastUpgradeCheck = 0700; 181 | }; 182 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 183 | compatibilityVersion = "Xcode 3.2"; 184 | developmentRegion = English; 185 | hasScannedForEncodings = 0; 186 | knownRegions = ( 187 | en, 188 | ); 189 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 190 | productRefGroup = 140C2C20FDD07F1253EB6E7CF0E6C54D /* Products */; 191 | projectDirPath = ""; 192 | projectRoot = ""; 193 | targets = ( 194 | 68FA21B5083A3B1146FB619FAD9C8C82 /* Pods-Demo */, 195 | ); 196 | }; 197 | /* End PBXProject section */ 198 | 199 | /* Begin PBXSourcesBuildPhase section */ 200 | 2A2D7772BFD94AFEA88CFD1466E4C45C /* Sources */ = { 201 | isa = PBXSourcesBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | 2955B06122271DB851399B082195174C /* Pods-Demo-dummy.m in Sources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | /* End PBXSourcesBuildPhase section */ 209 | 210 | /* Begin XCBuildConfiguration section */ 211 | 673254EEAF0B5BF4596080C749645884 /* Release */ = { 212 | isa = XCBuildConfiguration; 213 | buildSettings = { 214 | ALWAYS_SEARCH_USER_PATHS = NO; 215 | CLANG_ANALYZER_NONNULL = YES; 216 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 217 | CLANG_CXX_LIBRARY = "libc++"; 218 | CLANG_ENABLE_MODULES = YES; 219 | CLANG_ENABLE_OBJC_ARC = YES; 220 | CLANG_WARN_BOOL_CONVERSION = YES; 221 | CLANG_WARN_CONSTANT_CONVERSION = YES; 222 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 223 | CLANG_WARN_EMPTY_BODY = YES; 224 | CLANG_WARN_ENUM_CONVERSION = YES; 225 | CLANG_WARN_INT_CONVERSION = YES; 226 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 227 | CLANG_WARN_UNREACHABLE_CODE = YES; 228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 229 | CODE_SIGNING_REQUIRED = NO; 230 | COPY_PHASE_STRIP = YES; 231 | ENABLE_NS_ASSERTIONS = NO; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_PREPROCESSOR_DEFINITIONS = ( 234 | "POD_CONFIGURATION_RELEASE=1", 235 | "$(inherited)", 236 | ); 237 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 244 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 245 | STRIP_INSTALLED_PRODUCT = NO; 246 | SYMROOT = "${SRCROOT}/../build"; 247 | VALIDATE_PRODUCT = YES; 248 | }; 249 | name = Release; 250 | }; 251 | 84E010E7B62C312AEF0394F757153454 /* Release */ = { 252 | isa = XCBuildConfiguration; 253 | baseConfigurationReference = BC6F318B8C726435B2FF8566E7AC50B9 /* Pods-Demo.release.xcconfig */; 254 | buildSettings = { 255 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 257 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_STRICT_OBJC_MSGSEND = YES; 260 | GCC_NO_COMMON_BLOCKS = YES; 261 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 262 | MACH_O_TYPE = staticlib; 263 | MTL_ENABLE_DEBUG_INFO = NO; 264 | OTHER_LDFLAGS = ""; 265 | OTHER_LIBTOOLFLAGS = ""; 266 | PODS_ROOT = "$(SRCROOT)"; 267 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | SDKROOT = iphoneos; 270 | SKIP_INSTALL = YES; 271 | }; 272 | name = Release; 273 | }; 274 | 92F399F9595DC5C7ADC99D34290988C0 /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | baseConfigurationReference = 7E61E2F2E514A86FEC211F0AD10D8AC1 /* Pods-Demo.debug.xcconfig */; 277 | buildSettings = { 278 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 279 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 280 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 281 | DEBUG_INFORMATION_FORMAT = dwarf; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | GCC_NO_COMMON_BLOCKS = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 285 | MACH_O_TYPE = staticlib; 286 | MTL_ENABLE_DEBUG_INFO = YES; 287 | OTHER_LDFLAGS = ""; 288 | OTHER_LIBTOOLFLAGS = ""; 289 | PODS_ROOT = "$(SRCROOT)"; 290 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | SDKROOT = iphoneos; 293 | SKIP_INSTALL = YES; 294 | }; 295 | name = Debug; 296 | }; 297 | E4F26E6EB105713A6A7E7E2E283AC2DF /* Debug */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_ANALYZER_NONNULL = YES; 302 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 303 | CLANG_CXX_LIBRARY = "libc++"; 304 | CLANG_ENABLE_MODULES = YES; 305 | CLANG_ENABLE_OBJC_ARC = YES; 306 | CLANG_WARN_BOOL_CONVERSION = YES; 307 | CLANG_WARN_CONSTANT_CONVERSION = YES; 308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 309 | CLANG_WARN_EMPTY_BODY = YES; 310 | CLANG_WARN_ENUM_CONVERSION = YES; 311 | CLANG_WARN_INT_CONVERSION = YES; 312 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 313 | CLANG_WARN_UNREACHABLE_CODE = YES; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | CODE_SIGNING_REQUIRED = NO; 316 | COPY_PHASE_STRIP = NO; 317 | ENABLE_TESTABILITY = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_DYNAMIC_NO_PIC = NO; 320 | GCC_OPTIMIZATION_LEVEL = 0; 321 | GCC_PREPROCESSOR_DEFINITIONS = ( 322 | "POD_CONFIGURATION_DEBUG=1", 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 328 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 329 | GCC_WARN_UNDECLARED_SELECTOR = YES; 330 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 331 | GCC_WARN_UNUSED_FUNCTION = YES; 332 | GCC_WARN_UNUSED_VARIABLE = YES; 333 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 334 | ONLY_ACTIVE_ARCH = YES; 335 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 336 | STRIP_INSTALLED_PRODUCT = NO; 337 | SYMROOT = "${SRCROOT}/../build"; 338 | }; 339 | name = Debug; 340 | }; 341 | /* End XCBuildConfiguration section */ 342 | 343 | /* Begin XCConfigurationList section */ 344 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | E4F26E6EB105713A6A7E7E2E283AC2DF /* Debug */, 348 | 673254EEAF0B5BF4596080C749645884 /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | 8933D2A7BAEE21623B516A196784C4F3 /* Build configuration list for PBXNativeTarget "Pods-Demo" */ = { 354 | isa = XCConfigurationList; 355 | buildConfigurations = ( 356 | 92F399F9595DC5C7ADC99D34290988C0 /* Debug */, 357 | 84E010E7B62C312AEF0394F757153454 /* Release */, 358 | ); 359 | defaultConfigurationIsVisible = 0; 360 | defaultConfigurationName = Release; 361 | }; 362 | /* End XCConfigurationList section */ 363 | }; 364 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 365 | } 366 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/sunnyxx.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SuppressBuildableAutocreation 8 | 9 | 68FA21B5083A3B1146FB619FAD9C8C82 10 | 11 | primary 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## libffi-iOS 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 Yuan Sun 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2017 Yuan Sun 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | libffi-iOS 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Demo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Demo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | 80 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 83 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | fi 86 | rm -f "$RESOURCES_TO_COPY" 87 | 88 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 89 | then 90 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 91 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 92 | while read line; do 93 | if [[ $line != "${PODS_ROOT}*" ]]; then 94 | XCASSET_FILES+=("$line") 95 | fi 96 | done <<<"$OTHER_XCASSETS" 97 | 98 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | fi 100 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/libffi-iOS" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../libffi" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/libffi-iOS" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"ffi" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/libffi-iOS" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../libffi" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/libffi-iOS" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"ffi" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libffi-iOS 2 | stable libffi library for iOS (i386, x86_64, armv7, arm64) which has been fully verified 3 | -------------------------------------------------------------------------------- /libffi-iOS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'libffi-iOS' 3 | s.version = '1.0.0' 4 | s.summary = 'Stable libffi library for iOS (i386, x86_64, armv7, arm64) which has been fully verified.' 5 | s.description = <<-DESC 6 | libffi-iOS is built based on libffi-3.2.1, provides universal library 7 | (i386, x86_64, armv7, arm64), both ffi_call and ffi_closure are fully 8 | tested. 9 | https://github.com/sunnyxx/libffi-iOS 10 | by sunnyxx 11 | DESC 12 | s.platform = :ios 13 | s.homepage = 'https://github.com/sunnyxx/libffi-iOS' 14 | s.license = { :type => 'MIT', :file => 'LICENSE' } 15 | s.author = { 'sunnyxx' => 'sunyuan1713@gmail.com' } 16 | s.source = { :git => 'https://github.com/sunnyxx/libffi-iOS.git', :tag => s.version.to_s } 17 | 18 | s.ios.deployment_target = '6.0' 19 | 20 | s.vendored_libraries = 'libffi/libffi.a' 21 | s.source_files = 'libffi/*.h' 22 | end 23 | -------------------------------------------------------------------------------- /libffi/ffi.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | libffi 3.2.1 - Copyright (c) 2011, 2014 Anthony Green 3 | - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the ``Software''), to deal in the Software without 8 | restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* ------------------------------------------------------------------- 28 | libffi-iOS is built based on libffi-3.2.1, provides universal library 29 | (i386, x86_64, armv7, arm64), both ffi_call and ffi_closure are fully 30 | tested. 31 | https://github.com/sunnyxx/libffi-iOS 32 | by sunnyxx 33 | -------------------------------------------------------------------- */ 34 | 35 | #ifdef __arm64__ 36 | #include 37 | #endif 38 | 39 | #ifdef __i386__ 40 | #include 41 | #endif 42 | 43 | #ifdef __arm__ 44 | #include 45 | #endif 46 | 47 | #ifdef __x86_64__ 48 | #include 49 | #endif 50 | -------------------------------------------------------------------------------- /libffi/ffi_arm.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | libffi 3.99999 - Copyright (c) 2011, 2014 Anthony Green 3 | - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the ``Software''), to deal in the Software without 8 | restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* ------------------------------------------------------------------- 28 | Most of the API is documented in doc/libffi.texi. 29 | 30 | The raw API is designed to bypass some of the argument packing and 31 | unpacking on architectures for which it can be avoided. Routines 32 | are provided to emulate the raw API if the underlying platform 33 | doesn't allow faster implementation. 34 | 35 | More details on the raw API can be found in: 36 | 37 | http://gcc.gnu.org/ml/java/1999-q3/msg00138.html 38 | 39 | and 40 | 41 | http://gcc.gnu.org/ml/java/1999-q3/msg00174.html 42 | -------------------------------------------------------------------- */ 43 | 44 | #ifndef LIBFFI_H 45 | #define LIBFFI_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /* Specify which architecture libffi is configured for. */ 52 | #ifndef ARM 53 | #define ARM 54 | #endif 55 | 56 | /* ---- System configuration information --------------------------------- */ 57 | 58 | #include 59 | 60 | #ifndef LIBFFI_ASM 61 | 62 | #if defined(_MSC_VER) && !defined(__clang__) 63 | #define __attribute__(X) 64 | #endif 65 | 66 | #include 67 | #include 68 | 69 | /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). 70 | But we can find it either under the correct ANSI name, or under GNU 71 | C's internal name. */ 72 | 73 | #define FFI_64_BIT_MAX 9223372036854775807 74 | 75 | #ifdef LONG_LONG_MAX 76 | # define FFI_LONG_LONG_MAX LONG_LONG_MAX 77 | #else 78 | # ifdef LLONG_MAX 79 | # define FFI_LONG_LONG_MAX LLONG_MAX 80 | # ifdef _AIX52 /* or newer has C99 LLONG_MAX */ 81 | # undef FFI_64_BIT_MAX 82 | # define FFI_64_BIT_MAX 9223372036854775807LL 83 | # endif /* _AIX52 or newer */ 84 | # else 85 | # ifdef __GNUC__ 86 | # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ 87 | # endif 88 | # ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ 89 | # ifndef __PPC64__ 90 | # if defined (__IBMC__) || defined (__IBMCPP__) 91 | # define FFI_LONG_LONG_MAX LONGLONG_MAX 92 | # endif 93 | # endif /* __PPC64__ */ 94 | # undef FFI_64_BIT_MAX 95 | # define FFI_64_BIT_MAX 9223372036854775807LL 96 | # endif 97 | # endif 98 | #endif 99 | 100 | /* The closure code assumes that this works on pointers, i.e. a size_t 101 | can hold a pointer. */ 102 | 103 | typedef struct _ffi_type 104 | { 105 | size_t size; 106 | unsigned short alignment; 107 | unsigned short type; 108 | struct _ffi_type **elements; 109 | } ffi_type; 110 | 111 | #ifndef LIBFFI_HIDE_BASIC_TYPES 112 | #if SCHAR_MAX == 127 113 | # define ffi_type_uchar ffi_type_uint8 114 | # define ffi_type_schar ffi_type_sint8 115 | #else 116 | #error "char size not supported" 117 | #endif 118 | 119 | #if SHRT_MAX == 32767 120 | # define ffi_type_ushort ffi_type_uint16 121 | # define ffi_type_sshort ffi_type_sint16 122 | #elif SHRT_MAX == 2147483647 123 | # define ffi_type_ushort ffi_type_uint32 124 | # define ffi_type_sshort ffi_type_sint32 125 | #else 126 | #error "short size not supported" 127 | #endif 128 | 129 | #if INT_MAX == 32767 130 | # define ffi_type_uint ffi_type_uint16 131 | # define ffi_type_sint ffi_type_sint16 132 | #elif INT_MAX == 2147483647 133 | # define ffi_type_uint ffi_type_uint32 134 | # define ffi_type_sint ffi_type_sint32 135 | #elif INT_MAX == 9223372036854775807 136 | # define ffi_type_uint ffi_type_uint64 137 | # define ffi_type_sint ffi_type_sint64 138 | #else 139 | #error "int size not supported" 140 | #endif 141 | 142 | #if LONG_MAX == 2147483647 143 | # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX 144 | #error "no 64-bit data type supported" 145 | # endif 146 | #elif LONG_MAX != FFI_64_BIT_MAX 147 | #error "long size not supported" 148 | #endif 149 | 150 | #if LONG_MAX == 2147483647 151 | # define ffi_type_ulong ffi_type_uint32 152 | # define ffi_type_slong ffi_type_sint32 153 | #elif LONG_MAX == FFI_64_BIT_MAX 154 | # define ffi_type_ulong ffi_type_uint64 155 | # define ffi_type_slong ffi_type_sint64 156 | #else 157 | #error "long size not supported" 158 | #endif 159 | 160 | /* Need minimal decorations for DLLs to works on Windows. GCC has 161 | autoimport and autoexport. Rely on Libtool to help MSVC export 162 | from a DLL, but always declare data to be imported for MSVC 163 | clients. This costs an extra indirection for MSVC clients using 164 | the static version of the library, but don't worry about that. 165 | Besides, as a workaround, they can define FFI_BUILDING if they 166 | *know* they are going to link with the static library. */ 167 | #if defined _MSC_VER && !defined FFI_BUILDING 168 | #define FFI_EXTERN extern __declspec(dllimport) 169 | #else 170 | #define FFI_EXTERN extern 171 | #endif 172 | 173 | /* These are defined in types.c. */ 174 | FFI_EXTERN ffi_type ffi_type_void; 175 | FFI_EXTERN ffi_type ffi_type_uint8; 176 | FFI_EXTERN ffi_type ffi_type_sint8; 177 | FFI_EXTERN ffi_type ffi_type_uint16; 178 | FFI_EXTERN ffi_type ffi_type_sint16; 179 | FFI_EXTERN ffi_type ffi_type_uint32; 180 | FFI_EXTERN ffi_type ffi_type_sint32; 181 | FFI_EXTERN ffi_type ffi_type_uint64; 182 | FFI_EXTERN ffi_type ffi_type_sint64; 183 | FFI_EXTERN ffi_type ffi_type_float; 184 | FFI_EXTERN ffi_type ffi_type_double; 185 | FFI_EXTERN ffi_type ffi_type_pointer; 186 | 187 | #if 0 188 | FFI_EXTERN ffi_type ffi_type_longdouble; 189 | #else 190 | #define ffi_type_longdouble ffi_type_double 191 | #endif 192 | 193 | #ifdef FFI_TARGET_HAS_COMPLEX_TYPE 194 | FFI_EXTERN ffi_type ffi_type_complex_float; 195 | FFI_EXTERN ffi_type ffi_type_complex_double; 196 | #if 0 197 | FFI_EXTERN ffi_type ffi_type_complex_longdouble; 198 | #else 199 | #define ffi_type_complex_longdouble ffi_type_complex_double 200 | #endif 201 | #endif 202 | #endif /* LIBFFI_HIDE_BASIC_TYPES */ 203 | 204 | typedef enum { 205 | FFI_OK = 0, 206 | FFI_BAD_TYPEDEF, 207 | FFI_BAD_ABI 208 | } ffi_status; 209 | 210 | typedef struct { 211 | ffi_abi abi; 212 | unsigned nargs; 213 | ffi_type **arg_types; 214 | ffi_type *rtype; 215 | unsigned bytes; 216 | unsigned flags; 217 | #ifdef FFI_EXTRA_CIF_FIELDS 218 | FFI_EXTRA_CIF_FIELDS; 219 | #endif 220 | } ffi_cif; 221 | 222 | /* ---- Definitions for the raw API -------------------------------------- */ 223 | 224 | #ifndef FFI_SIZEOF_ARG 225 | # if LONG_MAX == 2147483647 226 | # define FFI_SIZEOF_ARG 4 227 | # elif LONG_MAX == FFI_64_BIT_MAX 228 | # define FFI_SIZEOF_ARG 8 229 | # endif 230 | #endif 231 | 232 | #ifndef FFI_SIZEOF_JAVA_RAW 233 | # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG 234 | #endif 235 | 236 | typedef union { 237 | ffi_sarg sint; 238 | ffi_arg uint; 239 | float flt; 240 | char data[FFI_SIZEOF_ARG]; 241 | void* ptr; 242 | } ffi_raw; 243 | 244 | #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 245 | /* This is a special case for mips64/n32 ABI (and perhaps others) where 246 | sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ 247 | typedef union { 248 | signed int sint; 249 | unsigned int uint; 250 | float flt; 251 | char data[FFI_SIZEOF_JAVA_RAW]; 252 | void* ptr; 253 | } ffi_java_raw; 254 | #else 255 | typedef ffi_raw ffi_java_raw; 256 | #endif 257 | 258 | 259 | void ffi_raw_call (ffi_cif *cif, 260 | void (*fn)(void), 261 | void *rvalue, 262 | ffi_raw *avalue); 263 | 264 | void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); 265 | void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); 266 | size_t ffi_raw_size (ffi_cif *cif); 267 | 268 | /* This is analogous to the raw API, except it uses Java parameter 269 | packing, even on 64-bit machines. I.e. on 64-bit machines longs 270 | and doubles are followed by an empty 64-bit word. */ 271 | 272 | void ffi_java_raw_call (ffi_cif *cif, 273 | void (*fn)(void), 274 | void *rvalue, 275 | ffi_java_raw *avalue); 276 | 277 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); 278 | void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); 279 | size_t ffi_java_raw_size (ffi_cif *cif); 280 | 281 | /* ---- Definitions for closures ----------------------------------------- */ 282 | 283 | #if FFI_CLOSURES 284 | 285 | #ifdef _MSC_VER 286 | __declspec(align(8)) 287 | #endif 288 | typedef struct { 289 | #if 1 290 | void *trampoline_table; 291 | void *trampoline_table_entry; 292 | #else 293 | char tramp[FFI_TRAMPOLINE_SIZE]; 294 | #endif 295 | ffi_cif *cif; 296 | void (*fun)(ffi_cif*,void*,void**,void*); 297 | void *user_data; 298 | } ffi_closure 299 | #ifdef __GNUC__ 300 | __attribute__((aligned (8))) 301 | #endif 302 | ; 303 | 304 | #ifndef __GNUC__ 305 | # ifdef __sgi 306 | # pragma pack 0 307 | # endif 308 | #endif 309 | 310 | void *ffi_closure_alloc (size_t size, void **code); 311 | void ffi_closure_free (void *); 312 | 313 | ffi_status 314 | ffi_prep_closure (ffi_closure*, 315 | ffi_cif *, 316 | void (*fun)(ffi_cif*,void*,void**,void*), 317 | void *user_data) 318 | __attribute__((deprecated ("use ffi_prep_closure_loc instead"))); 319 | 320 | ffi_status 321 | ffi_prep_closure_loc (ffi_closure*, 322 | ffi_cif *, 323 | void (*fun)(ffi_cif*,void*,void**,void*), 324 | void *user_data, 325 | void*codeloc); 326 | 327 | #ifdef __sgi 328 | # pragma pack 8 329 | #endif 330 | typedef struct { 331 | #if 1 332 | void *trampoline_table; 333 | void *trampoline_table_entry; 334 | #else 335 | char tramp[FFI_TRAMPOLINE_SIZE]; 336 | #endif 337 | ffi_cif *cif; 338 | 339 | #if !FFI_NATIVE_RAW_API 340 | 341 | /* If this is enabled, then a raw closure has the same layout 342 | as a regular closure. We use this to install an intermediate 343 | handler to do the transaltion, void** -> ffi_raw*. */ 344 | 345 | void (*translate_args)(ffi_cif*,void*,void**,void*); 346 | void *this_closure; 347 | 348 | #endif 349 | 350 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*); 351 | void *user_data; 352 | 353 | } ffi_raw_closure; 354 | 355 | typedef struct { 356 | #if 1 357 | void *trampoline_table; 358 | void *trampoline_table_entry; 359 | #else 360 | char tramp[FFI_TRAMPOLINE_SIZE]; 361 | #endif 362 | 363 | ffi_cif *cif; 364 | 365 | #if !FFI_NATIVE_RAW_API 366 | 367 | /* If this is enabled, then a raw closure has the same layout 368 | as a regular closure. We use this to install an intermediate 369 | handler to do the translation, void** -> ffi_raw*. */ 370 | 371 | void (*translate_args)(ffi_cif*,void*,void**,void*); 372 | void *this_closure; 373 | 374 | #endif 375 | 376 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); 377 | void *user_data; 378 | 379 | } ffi_java_raw_closure; 380 | 381 | ffi_status 382 | ffi_prep_raw_closure (ffi_raw_closure*, 383 | ffi_cif *cif, 384 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 385 | void *user_data); 386 | 387 | ffi_status 388 | ffi_prep_raw_closure_loc (ffi_raw_closure*, 389 | ffi_cif *cif, 390 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 391 | void *user_data, 392 | void *codeloc); 393 | 394 | ffi_status 395 | ffi_prep_java_raw_closure (ffi_java_raw_closure*, 396 | ffi_cif *cif, 397 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 398 | void *user_data); 399 | 400 | ffi_status 401 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, 402 | ffi_cif *cif, 403 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 404 | void *user_data, 405 | void *codeloc); 406 | 407 | #endif /* FFI_CLOSURES */ 408 | 409 | #if FFI_GO_CLOSURES 410 | 411 | typedef struct { 412 | void *tramp; 413 | ffi_cif *cif; 414 | void (*fun)(ffi_cif*,void*,void**,void*); 415 | } ffi_go_closure; 416 | 417 | ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, 418 | void (*fun)(ffi_cif*,void*,void**,void*)); 419 | 420 | void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, 421 | void **avalue, void *closure); 422 | 423 | #endif /* FFI_GO_CLOSURES */ 424 | 425 | /* ---- Public interface definition -------------------------------------- */ 426 | 427 | ffi_status ffi_prep_cif(ffi_cif *cif, 428 | ffi_abi abi, 429 | unsigned int nargs, 430 | ffi_type *rtype, 431 | ffi_type **atypes); 432 | 433 | ffi_status ffi_prep_cif_var(ffi_cif *cif, 434 | ffi_abi abi, 435 | unsigned int nfixedargs, 436 | unsigned int ntotalargs, 437 | ffi_type *rtype, 438 | ffi_type **atypes); 439 | 440 | void ffi_call(ffi_cif *cif, 441 | void (*fn)(void), 442 | void *rvalue, 443 | void **avalue); 444 | 445 | ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, 446 | size_t *offsets); 447 | 448 | /* Useful for eliminating compiler warnings. */ 449 | #define FFI_FN(f) ((void (*)(void))f) 450 | 451 | /* ---- Definitions shared with assembly code ---------------------------- */ 452 | 453 | #endif 454 | 455 | /* If these change, update src/mips/ffitarget.h. */ 456 | #define FFI_TYPE_VOID 0 457 | #define FFI_TYPE_INT 1 458 | #define FFI_TYPE_FLOAT 2 459 | #define FFI_TYPE_DOUBLE 3 460 | #if 0 461 | #define FFI_TYPE_LONGDOUBLE 4 462 | #else 463 | #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE 464 | #endif 465 | #define FFI_TYPE_UINT8 5 466 | #define FFI_TYPE_SINT8 6 467 | #define FFI_TYPE_UINT16 7 468 | #define FFI_TYPE_SINT16 8 469 | #define FFI_TYPE_UINT32 9 470 | #define FFI_TYPE_SINT32 10 471 | #define FFI_TYPE_UINT64 11 472 | #define FFI_TYPE_SINT64 12 473 | #define FFI_TYPE_STRUCT 13 474 | #define FFI_TYPE_POINTER 14 475 | #define FFI_TYPE_COMPLEX 15 476 | 477 | /* This should always refer to the last type code (for sanity checks). */ 478 | #define FFI_TYPE_LAST FFI_TYPE_COMPLEX 479 | 480 | #ifdef __cplusplus 481 | } 482 | #endif 483 | 484 | #endif 485 | -------------------------------------------------------------------------------- /libffi/ffi_arm64.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | libffi 3.99999 - Copyright (c) 2011, 2014 Anthony Green 3 | - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the ``Software''), to deal in the Software without 8 | restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* ------------------------------------------------------------------- 28 | Most of the API is documented in doc/libffi.texi. 29 | 30 | The raw API is designed to bypass some of the argument packing and 31 | unpacking on architectures for which it can be avoided. Routines 32 | are provided to emulate the raw API if the underlying platform 33 | doesn't allow faster implementation. 34 | 35 | More details on the raw API can be found in: 36 | 37 | http://gcc.gnu.org/ml/java/1999-q3/msg00138.html 38 | 39 | and 40 | 41 | http://gcc.gnu.org/ml/java/1999-q3/msg00174.html 42 | -------------------------------------------------------------------- */ 43 | 44 | #ifndef LIBFFI_H 45 | #define LIBFFI_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /* Specify which architecture libffi is configured for. */ 52 | #ifndef AARCH64 53 | #define AARCH64 54 | #endif 55 | 56 | /* ---- System configuration information --------------------------------- */ 57 | 58 | #include "ffitarget.h" 59 | 60 | #ifndef LIBFFI_ASM 61 | 62 | #if defined(_MSC_VER) && !defined(__clang__) 63 | #define __attribute__(X) 64 | #endif 65 | 66 | #include 67 | #include 68 | 69 | /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). 70 | But we can find it either under the correct ANSI name, or under GNU 71 | C's internal name. */ 72 | 73 | #define FFI_64_BIT_MAX 9223372036854775807 74 | 75 | #ifdef LONG_LONG_MAX 76 | # define FFI_LONG_LONG_MAX LONG_LONG_MAX 77 | #else 78 | # ifdef LLONG_MAX 79 | # define FFI_LONG_LONG_MAX LLONG_MAX 80 | # ifdef _AIX52 /* or newer has C99 LLONG_MAX */ 81 | # undef FFI_64_BIT_MAX 82 | # define FFI_64_BIT_MAX 9223372036854775807LL 83 | # endif /* _AIX52 or newer */ 84 | # else 85 | # ifdef __GNUC__ 86 | # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ 87 | # endif 88 | # ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ 89 | # ifndef __PPC64__ 90 | # if defined (__IBMC__) || defined (__IBMCPP__) 91 | # define FFI_LONG_LONG_MAX LONGLONG_MAX 92 | # endif 93 | # endif /* __PPC64__ */ 94 | # undef FFI_64_BIT_MAX 95 | # define FFI_64_BIT_MAX 9223372036854775807LL 96 | # endif 97 | # endif 98 | #endif 99 | 100 | /* The closure code assumes that this works on pointers, i.e. a size_t 101 | can hold a pointer. */ 102 | 103 | typedef struct _ffi_type 104 | { 105 | size_t size; 106 | unsigned short alignment; 107 | unsigned short type; 108 | struct _ffi_type **elements; 109 | } ffi_type; 110 | 111 | #ifndef LIBFFI_HIDE_BASIC_TYPES 112 | #if SCHAR_MAX == 127 113 | # define ffi_type_uchar ffi_type_uint8 114 | # define ffi_type_schar ffi_type_sint8 115 | #else 116 | #error "char size not supported" 117 | #endif 118 | 119 | #if SHRT_MAX == 32767 120 | # define ffi_type_ushort ffi_type_uint16 121 | # define ffi_type_sshort ffi_type_sint16 122 | #elif SHRT_MAX == 2147483647 123 | # define ffi_type_ushort ffi_type_uint32 124 | # define ffi_type_sshort ffi_type_sint32 125 | #else 126 | #error "short size not supported" 127 | #endif 128 | 129 | #if INT_MAX == 32767 130 | # define ffi_type_uint ffi_type_uint16 131 | # define ffi_type_sint ffi_type_sint16 132 | #elif INT_MAX == 2147483647 133 | # define ffi_type_uint ffi_type_uint32 134 | # define ffi_type_sint ffi_type_sint32 135 | #elif INT_MAX == 9223372036854775807 136 | # define ffi_type_uint ffi_type_uint64 137 | # define ffi_type_sint ffi_type_sint64 138 | #else 139 | #error "int size not supported" 140 | #endif 141 | 142 | #if LONG_MAX == 2147483647 143 | # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX 144 | #error "no 64-bit data type supported" 145 | # endif 146 | #elif LONG_MAX != FFI_64_BIT_MAX 147 | #error "long size not supported" 148 | #endif 149 | 150 | #if LONG_MAX == 2147483647 151 | # define ffi_type_ulong ffi_type_uint32 152 | # define ffi_type_slong ffi_type_sint32 153 | #elif LONG_MAX == FFI_64_BIT_MAX 154 | # define ffi_type_ulong ffi_type_uint64 155 | # define ffi_type_slong ffi_type_sint64 156 | #else 157 | #error "long size not supported" 158 | #endif 159 | 160 | /* Need minimal decorations for DLLs to works on Windows. GCC has 161 | autoimport and autoexport. Rely on Libtool to help MSVC export 162 | from a DLL, but always declare data to be imported for MSVC 163 | clients. This costs an extra indirection for MSVC clients using 164 | the static version of the library, but don't worry about that. 165 | Besides, as a workaround, they can define FFI_BUILDING if they 166 | *know* they are going to link with the static library. */ 167 | #if defined _MSC_VER && !defined FFI_BUILDING 168 | #define FFI_EXTERN extern __declspec(dllimport) 169 | #else 170 | #define FFI_EXTERN extern 171 | #endif 172 | 173 | /* These are defined in types.c. */ 174 | FFI_EXTERN ffi_type ffi_type_void; 175 | FFI_EXTERN ffi_type ffi_type_uint8; 176 | FFI_EXTERN ffi_type ffi_type_sint8; 177 | FFI_EXTERN ffi_type ffi_type_uint16; 178 | FFI_EXTERN ffi_type ffi_type_sint16; 179 | FFI_EXTERN ffi_type ffi_type_uint32; 180 | FFI_EXTERN ffi_type ffi_type_sint32; 181 | FFI_EXTERN ffi_type ffi_type_uint64; 182 | FFI_EXTERN ffi_type ffi_type_sint64; 183 | FFI_EXTERN ffi_type ffi_type_float; 184 | FFI_EXTERN ffi_type ffi_type_double; 185 | FFI_EXTERN ffi_type ffi_type_pointer; 186 | 187 | #if 0 188 | FFI_EXTERN ffi_type ffi_type_longdouble; 189 | #else 190 | #define ffi_type_longdouble ffi_type_double 191 | #endif 192 | 193 | #ifdef FFI_TARGET_HAS_COMPLEX_TYPE 194 | FFI_EXTERN ffi_type ffi_type_complex_float; 195 | FFI_EXTERN ffi_type ffi_type_complex_double; 196 | #if 0 197 | FFI_EXTERN ffi_type ffi_type_complex_longdouble; 198 | #else 199 | #define ffi_type_complex_longdouble ffi_type_complex_double 200 | #endif 201 | #endif 202 | #endif /* LIBFFI_HIDE_BASIC_TYPES */ 203 | 204 | typedef enum { 205 | FFI_OK = 0, 206 | FFI_BAD_TYPEDEF, 207 | FFI_BAD_ABI 208 | } ffi_status; 209 | 210 | typedef struct { 211 | ffi_abi abi; 212 | unsigned nargs; 213 | ffi_type **arg_types; 214 | ffi_type *rtype; 215 | unsigned bytes; 216 | unsigned flags; 217 | #ifdef FFI_EXTRA_CIF_FIELDS 218 | FFI_EXTRA_CIF_FIELDS; 219 | #endif 220 | } ffi_cif; 221 | 222 | /* ---- Definitions for the raw API -------------------------------------- */ 223 | 224 | #ifndef FFI_SIZEOF_ARG 225 | # if LONG_MAX == 2147483647 226 | # define FFI_SIZEOF_ARG 4 227 | # elif LONG_MAX == FFI_64_BIT_MAX 228 | # define FFI_SIZEOF_ARG 8 229 | # endif 230 | #endif 231 | 232 | #ifndef FFI_SIZEOF_JAVA_RAW 233 | # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG 234 | #endif 235 | 236 | typedef union { 237 | ffi_sarg sint; 238 | ffi_arg uint; 239 | float flt; 240 | char data[FFI_SIZEOF_ARG]; 241 | void* ptr; 242 | } ffi_raw; 243 | 244 | #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 245 | /* This is a special case for mips64/n32 ABI (and perhaps others) where 246 | sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ 247 | typedef union { 248 | signed int sint; 249 | unsigned int uint; 250 | float flt; 251 | char data[FFI_SIZEOF_JAVA_RAW]; 252 | void* ptr; 253 | } ffi_java_raw; 254 | #else 255 | typedef ffi_raw ffi_java_raw; 256 | #endif 257 | 258 | 259 | void ffi_raw_call (ffi_cif *cif, 260 | void (*fn)(void), 261 | void *rvalue, 262 | ffi_raw *avalue); 263 | 264 | void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); 265 | void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); 266 | size_t ffi_raw_size (ffi_cif *cif); 267 | 268 | /* This is analogous to the raw API, except it uses Java parameter 269 | packing, even on 64-bit machines. I.e. on 64-bit machines longs 270 | and doubles are followed by an empty 64-bit word. */ 271 | 272 | void ffi_java_raw_call (ffi_cif *cif, 273 | void (*fn)(void), 274 | void *rvalue, 275 | ffi_java_raw *avalue); 276 | 277 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); 278 | void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); 279 | size_t ffi_java_raw_size (ffi_cif *cif); 280 | 281 | /* ---- Definitions for closures ----------------------------------------- */ 282 | 283 | #if FFI_CLOSURES 284 | 285 | #ifdef _MSC_VER 286 | __declspec(align(8)) 287 | #endif 288 | typedef struct { 289 | #if 1 290 | void *trampoline_table; 291 | void *trampoline_table_entry; 292 | #else 293 | char tramp[FFI_TRAMPOLINE_SIZE]; 294 | #endif 295 | ffi_cif *cif; 296 | void (*fun)(ffi_cif*,void*,void**,void*); 297 | void *user_data; 298 | } ffi_closure 299 | #ifdef __GNUC__ 300 | __attribute__((aligned (8))) 301 | #endif 302 | ; 303 | 304 | #ifndef __GNUC__ 305 | # ifdef __sgi 306 | # pragma pack 0 307 | # endif 308 | #endif 309 | 310 | void *ffi_closure_alloc (size_t size, void **code); 311 | void ffi_closure_free (void *); 312 | 313 | ffi_status 314 | ffi_prep_closure (ffi_closure*, 315 | ffi_cif *, 316 | void (*fun)(ffi_cif*,void*,void**,void*), 317 | void *user_data) 318 | __attribute__((deprecated ("use ffi_prep_closure_loc instead"))); 319 | 320 | ffi_status 321 | ffi_prep_closure_loc (ffi_closure*, 322 | ffi_cif *, 323 | void (*fun)(ffi_cif*,void*,void**,void*), 324 | void *user_data, 325 | void*codeloc); 326 | 327 | #ifdef __sgi 328 | # pragma pack 8 329 | #endif 330 | typedef struct { 331 | #if 1 332 | void *trampoline_table; 333 | void *trampoline_table_entry; 334 | #else 335 | char tramp[FFI_TRAMPOLINE_SIZE]; 336 | #endif 337 | ffi_cif *cif; 338 | 339 | #if !FFI_NATIVE_RAW_API 340 | 341 | /* If this is enabled, then a raw closure has the same layout 342 | as a regular closure. We use this to install an intermediate 343 | handler to do the transaltion, void** -> ffi_raw*. */ 344 | 345 | void (*translate_args)(ffi_cif*,void*,void**,void*); 346 | void *this_closure; 347 | 348 | #endif 349 | 350 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*); 351 | void *user_data; 352 | 353 | } ffi_raw_closure; 354 | 355 | typedef struct { 356 | #if 1 357 | void *trampoline_table; 358 | void *trampoline_table_entry; 359 | #else 360 | char tramp[FFI_TRAMPOLINE_SIZE]; 361 | #endif 362 | 363 | ffi_cif *cif; 364 | 365 | #if !FFI_NATIVE_RAW_API 366 | 367 | /* If this is enabled, then a raw closure has the same layout 368 | as a regular closure. We use this to install an intermediate 369 | handler to do the translation, void** -> ffi_raw*. */ 370 | 371 | void (*translate_args)(ffi_cif*,void*,void**,void*); 372 | void *this_closure; 373 | 374 | #endif 375 | 376 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); 377 | void *user_data; 378 | 379 | } ffi_java_raw_closure; 380 | 381 | ffi_status 382 | ffi_prep_raw_closure (ffi_raw_closure*, 383 | ffi_cif *cif, 384 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 385 | void *user_data); 386 | 387 | ffi_status 388 | ffi_prep_raw_closure_loc (ffi_raw_closure*, 389 | ffi_cif *cif, 390 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 391 | void *user_data, 392 | void *codeloc); 393 | 394 | ffi_status 395 | ffi_prep_java_raw_closure (ffi_java_raw_closure*, 396 | ffi_cif *cif, 397 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 398 | void *user_data); 399 | 400 | ffi_status 401 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, 402 | ffi_cif *cif, 403 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 404 | void *user_data, 405 | void *codeloc); 406 | 407 | #endif /* FFI_CLOSURES */ 408 | 409 | #if FFI_GO_CLOSURES 410 | 411 | typedef struct { 412 | void *tramp; 413 | ffi_cif *cif; 414 | void (*fun)(ffi_cif*,void*,void**,void*); 415 | } ffi_go_closure; 416 | 417 | ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, 418 | void (*fun)(ffi_cif*,void*,void**,void*)); 419 | 420 | void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, 421 | void **avalue, void *closure); 422 | 423 | #endif /* FFI_GO_CLOSURES */ 424 | 425 | /* ---- Public interface definition -------------------------------------- */ 426 | 427 | ffi_status ffi_prep_cif(ffi_cif *cif, 428 | ffi_abi abi, 429 | unsigned int nargs, 430 | ffi_type *rtype, 431 | ffi_type **atypes); 432 | 433 | ffi_status ffi_prep_cif_var(ffi_cif *cif, 434 | ffi_abi abi, 435 | unsigned int nfixedargs, 436 | unsigned int ntotalargs, 437 | ffi_type *rtype, 438 | ffi_type **atypes); 439 | 440 | void ffi_call(ffi_cif *cif, 441 | void (*fn)(void), 442 | void *rvalue, 443 | void **avalue); 444 | 445 | ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, 446 | size_t *offsets); 447 | 448 | /* Useful for eliminating compiler warnings. */ 449 | #define FFI_FN(f) ((void (*)(void))f) 450 | 451 | /* ---- Definitions shared with assembly code ---------------------------- */ 452 | 453 | #endif 454 | 455 | /* If these change, update src/mips/ffitarget.h. */ 456 | #define FFI_TYPE_VOID 0 457 | #define FFI_TYPE_INT 1 458 | #define FFI_TYPE_FLOAT 2 459 | #define FFI_TYPE_DOUBLE 3 460 | #if 0 461 | #define FFI_TYPE_LONGDOUBLE 4 462 | #else 463 | #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE 464 | #endif 465 | #define FFI_TYPE_UINT8 5 466 | #define FFI_TYPE_SINT8 6 467 | #define FFI_TYPE_UINT16 7 468 | #define FFI_TYPE_SINT16 8 469 | #define FFI_TYPE_UINT32 9 470 | #define FFI_TYPE_SINT32 10 471 | #define FFI_TYPE_UINT64 11 472 | #define FFI_TYPE_SINT64 12 473 | #define FFI_TYPE_STRUCT 13 474 | #define FFI_TYPE_POINTER 14 475 | #define FFI_TYPE_COMPLEX 15 476 | 477 | /* This should always refer to the last type code (for sanity checks). */ 478 | #define FFI_TYPE_LAST FFI_TYPE_COMPLEX 479 | 480 | #ifdef __cplusplus 481 | } 482 | #endif 483 | 484 | #endif 485 | -------------------------------------------------------------------------------- /libffi/ffi_common.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green 3 | Copyright (C) 2007 Free Software Foundation, Inc 4 | Copyright (c) 1996 Red Hat, Inc. 5 | 6 | Common internal definitions and macros. Only necessary for building 7 | libffi. 8 | ----------------------------------------------------------------------- */ 9 | 10 | #ifndef FFI_COMMON_H 11 | #define FFI_COMMON_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #include 18 | 19 | /* Do not move this. Some versions of AIX are very picky about where 20 | this is positioned. */ 21 | #ifdef __GNUC__ 22 | # if HAVE_ALLOCA_H 23 | # include 24 | # else 25 | /* mingw64 defines this already in malloc.h. */ 26 | # ifndef alloca 27 | # define alloca __builtin_alloca 28 | # endif 29 | # endif 30 | # define MAYBE_UNUSED __attribute__((__unused__)) 31 | #else 32 | # define MAYBE_UNUSED 33 | # if HAVE_ALLOCA_H 34 | # include 35 | # else 36 | # ifdef _AIX 37 | # pragma alloca 38 | # else 39 | # ifndef alloca /* predefined by HP cc +Olibcalls */ 40 | # ifdef _MSC_VER 41 | # define alloca _alloca 42 | # else 43 | char *alloca (); 44 | # endif 45 | # endif 46 | # endif 47 | # endif 48 | #endif 49 | 50 | /* Check for the existence of memcpy. */ 51 | #if STDC_HEADERS 52 | # include 53 | #else 54 | # ifndef HAVE_MEMCPY 55 | # define memcpy(d, s, n) bcopy ((s), (d), (n)) 56 | # endif 57 | #endif 58 | 59 | #if defined(FFI_DEBUG) 60 | #include 61 | #endif 62 | 63 | #ifdef FFI_DEBUG 64 | void ffi_assert(char *expr, char *file, int line); 65 | void ffi_stop_here(void); 66 | void ffi_type_test(ffi_type *a, char *file, int line); 67 | 68 | #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) 69 | #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) 70 | #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) 71 | #else 72 | #define FFI_ASSERT(x) 73 | #define FFI_ASSERT_AT(x, f, l) 74 | #define FFI_ASSERT_VALID_TYPE(x) 75 | #endif 76 | 77 | #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) 78 | #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) 79 | 80 | /* Perform machine dependent cif processing */ 81 | ffi_status ffi_prep_cif_machdep(ffi_cif *cif); 82 | ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, 83 | unsigned int nfixedargs, unsigned int ntotalargs); 84 | 85 | 86 | #if HAVE_LONG_DOUBLE_VARIANT 87 | /* Used to adjust size/alignment of ffi types. */ 88 | void ffi_prep_types (ffi_abi abi); 89 | #endif 90 | 91 | /* Used internally, but overridden by some architectures */ 92 | ffi_status ffi_prep_cif_core(ffi_cif *cif, 93 | ffi_abi abi, 94 | unsigned int isvariadic, 95 | unsigned int nfixedargs, 96 | unsigned int ntotalargs, 97 | ffi_type *rtype, 98 | ffi_type **atypes); 99 | 100 | /* Extended cif, used in callback from assembly routine */ 101 | typedef struct 102 | { 103 | ffi_cif *cif; 104 | void *rvalue; 105 | void **avalue; 106 | } extended_cif; 107 | 108 | /* Terse sized type definitions. */ 109 | #if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) 110 | typedef unsigned char UINT8; 111 | typedef signed char SINT8; 112 | typedef unsigned short UINT16; 113 | typedef signed short SINT16; 114 | typedef unsigned int UINT32; 115 | typedef signed int SINT32; 116 | # ifdef _MSC_VER 117 | typedef unsigned __int64 UINT64; 118 | typedef signed __int64 SINT64; 119 | # else 120 | # include 121 | typedef uint64_t UINT64; 122 | typedef int64_t SINT64; 123 | # endif 124 | #else 125 | typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); 126 | typedef signed int SINT8 __attribute__((__mode__(__QI__))); 127 | typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); 128 | typedef signed int SINT16 __attribute__((__mode__(__HI__))); 129 | typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); 130 | typedef signed int SINT32 __attribute__((__mode__(__SI__))); 131 | typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); 132 | typedef signed int SINT64 __attribute__((__mode__(__DI__))); 133 | #endif 134 | 135 | typedef float FLOAT32; 136 | 137 | #ifndef __GNUC__ 138 | #define __builtin_expect(x, expected_value) (x) 139 | #endif 140 | #define LIKELY(x) __builtin_expect(!!(x),1) 141 | #define UNLIKELY(x) __builtin_expect((x)!=0,0) 142 | 143 | #ifdef __cplusplus 144 | } 145 | #endif 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /libffi/ffi_i386.h: -------------------------------------------------------------------------------- 1 | #ifdef __i386__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | libffi 3.2.1 - Copyright (c) 2011, 2014 Anthony Green 5 | - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person 8 | obtaining a copy of this software and associated documentation 9 | files (the ``Software''), to deal in the Software without 10 | restriction, including without limitation the rights to use, copy, 11 | modify, merge, publish, distribute, sublicense, and/or sell copies 12 | of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | 27 | ----------------------------------------------------------------------- */ 28 | 29 | /* ------------------------------------------------------------------- 30 | The basic API is described in the README file. 31 | 32 | The raw API is designed to bypass some of the argument packing 33 | and unpacking on architectures for which it can be avoided. 34 | 35 | The closure API allows interpreted functions to be packaged up 36 | inside a C function pointer, so that they can be called as C functions, 37 | with no understanding on the client side that they are interpreted. 38 | It can also be used in other cases in which it is necessary to package 39 | up a user specified parameter and a function pointer as a single 40 | function pointer. 41 | 42 | The closure API must be implemented in order to get its functionality, 43 | e.g. for use by gij. Routines are provided to emulate the raw API 44 | if the underlying platform doesn't allow faster implementation. 45 | 46 | More details on the raw and cloure API can be found in: 47 | 48 | http://gcc.gnu.org/ml/java/1999-q3/msg00138.html 49 | 50 | and 51 | 52 | http://gcc.gnu.org/ml/java/1999-q3/msg00174.html 53 | -------------------------------------------------------------------- */ 54 | 55 | #ifndef LIBFFI_H 56 | #define LIBFFI_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | /* Specify which architecture libffi is configured for. */ 63 | #ifndef X86_DARWIN 64 | #define X86_DARWIN 65 | #endif 66 | 67 | /* ---- System configuration information --------------------------------- */ 68 | 69 | #include 70 | 71 | #ifndef LIBFFI_ASM 72 | 73 | #if defined(_MSC_VER) && !defined(__clang__) 74 | #define __attribute__(X) 75 | #endif 76 | 77 | #include 78 | #include 79 | 80 | /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). 81 | But we can find it either under the correct ANSI name, or under GNU 82 | C's internal name. */ 83 | 84 | #define FFI_64_BIT_MAX 9223372036854775807 85 | 86 | #ifdef LONG_LONG_MAX 87 | # define FFI_LONG_LONG_MAX LONG_LONG_MAX 88 | #else 89 | # ifdef LLONG_MAX 90 | # define FFI_LONG_LONG_MAX LLONG_MAX 91 | # ifdef _AIX52 /* or newer has C99 LLONG_MAX */ 92 | # undef FFI_64_BIT_MAX 93 | # define FFI_64_BIT_MAX 9223372036854775807LL 94 | # endif /* _AIX52 or newer */ 95 | # else 96 | # ifdef __GNUC__ 97 | # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ 98 | # endif 99 | # ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ 100 | # ifndef __PPC64__ 101 | # if defined (__IBMC__) || defined (__IBMCPP__) 102 | # define FFI_LONG_LONG_MAX LONGLONG_MAX 103 | # endif 104 | # endif /* __PPC64__ */ 105 | # undef FFI_64_BIT_MAX 106 | # define FFI_64_BIT_MAX 9223372036854775807LL 107 | # endif 108 | # endif 109 | #endif 110 | 111 | /* The closure code assumes that this works on pointers, i.e. a size_t */ 112 | /* can hold a pointer. */ 113 | 114 | typedef struct _ffi_type 115 | { 116 | size_t size; 117 | unsigned short alignment; 118 | unsigned short type; 119 | struct _ffi_type **elements; 120 | } ffi_type; 121 | 122 | #ifndef LIBFFI_HIDE_BASIC_TYPES 123 | #if SCHAR_MAX == 127 124 | # define ffi_type_uchar ffi_type_uint8 125 | # define ffi_type_schar ffi_type_sint8 126 | #else 127 | #error "char size not supported" 128 | #endif 129 | 130 | #if SHRT_MAX == 32767 131 | # define ffi_type_ushort ffi_type_uint16 132 | # define ffi_type_sshort ffi_type_sint16 133 | #elif SHRT_MAX == 2147483647 134 | # define ffi_type_ushort ffi_type_uint32 135 | # define ffi_type_sshort ffi_type_sint32 136 | #else 137 | #error "short size not supported" 138 | #endif 139 | 140 | #if INT_MAX == 32767 141 | # define ffi_type_uint ffi_type_uint16 142 | # define ffi_type_sint ffi_type_sint16 143 | #elif INT_MAX == 2147483647 144 | # define ffi_type_uint ffi_type_uint32 145 | # define ffi_type_sint ffi_type_sint32 146 | #elif INT_MAX == 9223372036854775807 147 | # define ffi_type_uint ffi_type_uint64 148 | # define ffi_type_sint ffi_type_sint64 149 | #else 150 | #error "int size not supported" 151 | #endif 152 | 153 | #if LONG_MAX == 2147483647 154 | # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX 155 | #error "no 64-bit data type supported" 156 | # endif 157 | #elif LONG_MAX != FFI_64_BIT_MAX 158 | #error "long size not supported" 159 | #endif 160 | 161 | #if LONG_MAX == 2147483647 162 | # define ffi_type_ulong ffi_type_uint32 163 | # define ffi_type_slong ffi_type_sint32 164 | #elif LONG_MAX == FFI_64_BIT_MAX 165 | # define ffi_type_ulong ffi_type_uint64 166 | # define ffi_type_slong ffi_type_sint64 167 | #else 168 | #error "long size not supported" 169 | #endif 170 | 171 | /* Need minimal decorations for DLLs to works on Windows. */ 172 | /* GCC has autoimport and autoexport. Rely on Libtool to */ 173 | /* help MSVC export from a DLL, but always declare data */ 174 | /* to be imported for MSVC clients. This costs an extra */ 175 | /* indirection for MSVC clients using the static version */ 176 | /* of the library, but don't worry about that. Besides, */ 177 | /* as a workaround, they can define FFI_BUILDING if they */ 178 | /* *know* they are going to link with the static library. */ 179 | #if defined _MSC_VER && !defined FFI_BUILDING 180 | #define FFI_EXTERN extern __declspec(dllimport) 181 | #else 182 | #define FFI_EXTERN extern 183 | #endif 184 | 185 | /* These are defined in types.c */ 186 | FFI_EXTERN ffi_type ffi_type_void; 187 | FFI_EXTERN ffi_type ffi_type_uint8; 188 | FFI_EXTERN ffi_type ffi_type_sint8; 189 | FFI_EXTERN ffi_type ffi_type_uint16; 190 | FFI_EXTERN ffi_type ffi_type_sint16; 191 | FFI_EXTERN ffi_type ffi_type_uint32; 192 | FFI_EXTERN ffi_type ffi_type_sint32; 193 | FFI_EXTERN ffi_type ffi_type_uint64; 194 | FFI_EXTERN ffi_type ffi_type_sint64; 195 | FFI_EXTERN ffi_type ffi_type_float; 196 | FFI_EXTERN ffi_type ffi_type_double; 197 | FFI_EXTERN ffi_type ffi_type_pointer; 198 | 199 | #if 1 200 | FFI_EXTERN ffi_type ffi_type_longdouble; 201 | #else 202 | #define ffi_type_longdouble ffi_type_double 203 | #endif 204 | 205 | #ifdef FFI_TARGET_HAS_COMPLEX_TYPE 206 | FFI_EXTERN ffi_type ffi_type_complex_float; 207 | FFI_EXTERN ffi_type ffi_type_complex_double; 208 | #if 1 209 | FFI_EXTERN ffi_type ffi_type_complex_longdouble; 210 | #else 211 | #define ffi_type_complex_longdouble ffi_type_complex_double 212 | #endif 213 | #endif 214 | #endif /* LIBFFI_HIDE_BASIC_TYPES */ 215 | 216 | typedef enum { 217 | FFI_OK = 0, 218 | FFI_BAD_TYPEDEF, 219 | FFI_BAD_ABI 220 | } ffi_status; 221 | 222 | typedef unsigned FFI_TYPE; 223 | 224 | typedef struct { 225 | ffi_abi abi; 226 | unsigned nargs; 227 | ffi_type **arg_types; 228 | ffi_type *rtype; 229 | unsigned bytes; 230 | unsigned flags; 231 | #ifdef FFI_EXTRA_CIF_FIELDS 232 | FFI_EXTRA_CIF_FIELDS; 233 | #endif 234 | } ffi_cif; 235 | 236 | #if 0 237 | /* Used to adjust size/alignment of ffi types. */ 238 | void ffi_prep_types (ffi_abi abi); 239 | #endif 240 | 241 | /* Used internally, but overridden by some architectures */ 242 | ffi_status ffi_prep_cif_core(ffi_cif *cif, 243 | ffi_abi abi, 244 | unsigned int isvariadic, 245 | unsigned int nfixedargs, 246 | unsigned int ntotalargs, 247 | ffi_type *rtype, 248 | ffi_type **atypes); 249 | 250 | /* ---- Definitions for the raw API -------------------------------------- */ 251 | 252 | #ifndef FFI_SIZEOF_ARG 253 | # if LONG_MAX == 2147483647 254 | # define FFI_SIZEOF_ARG 4 255 | # elif LONG_MAX == FFI_64_BIT_MAX 256 | # define FFI_SIZEOF_ARG 8 257 | # endif 258 | #endif 259 | 260 | #ifndef FFI_SIZEOF_JAVA_RAW 261 | # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG 262 | #endif 263 | 264 | typedef union { 265 | ffi_sarg sint; 266 | ffi_arg uint; 267 | float flt; 268 | char data[FFI_SIZEOF_ARG]; 269 | void* ptr; 270 | } ffi_raw; 271 | 272 | #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 273 | /* This is a special case for mips64/n32 ABI (and perhaps others) where 274 | sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ 275 | typedef union { 276 | signed int sint; 277 | unsigned int uint; 278 | float flt; 279 | char data[FFI_SIZEOF_JAVA_RAW]; 280 | void* ptr; 281 | } ffi_java_raw; 282 | #else 283 | typedef ffi_raw ffi_java_raw; 284 | #endif 285 | 286 | 287 | void ffi_raw_call (ffi_cif *cif, 288 | void (*fn)(void), 289 | void *rvalue, 290 | ffi_raw *avalue); 291 | 292 | void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); 293 | void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); 294 | size_t ffi_raw_size (ffi_cif *cif); 295 | 296 | /* This is analogous to the raw API, except it uses Java parameter */ 297 | /* packing, even on 64-bit machines. I.e. on 64-bit machines */ 298 | /* longs and doubles are followed by an empty 64-bit word. */ 299 | 300 | void ffi_java_raw_call (ffi_cif *cif, 301 | void (*fn)(void), 302 | void *rvalue, 303 | ffi_java_raw *avalue); 304 | 305 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); 306 | void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); 307 | size_t ffi_java_raw_size (ffi_cif *cif); 308 | 309 | /* ---- Definitions for closures ----------------------------------------- */ 310 | 311 | #if FFI_CLOSURES 312 | 313 | #ifdef _MSC_VER 314 | __declspec(align(8)) 315 | #endif 316 | typedef struct { 317 | #if 0 318 | void *trampoline_table; 319 | void *trampoline_table_entry; 320 | #else 321 | char tramp[FFI_TRAMPOLINE_SIZE]; 322 | #endif 323 | ffi_cif *cif; 324 | void (*fun)(ffi_cif*,void*,void**,void*); 325 | void *user_data; 326 | #ifdef __GNUC__ 327 | } ffi_closure __attribute__((aligned (8))); 328 | #else 329 | } ffi_closure; 330 | # ifdef __sgi 331 | # pragma pack 0 332 | # endif 333 | #endif 334 | 335 | void *ffi_closure_alloc (size_t size, void **code); 336 | void ffi_closure_free (void *); 337 | 338 | ffi_status 339 | ffi_prep_closure (ffi_closure*, 340 | ffi_cif *, 341 | void (*fun)(ffi_cif*,void*,void**,void*), 342 | void *user_data); 343 | 344 | ffi_status 345 | ffi_prep_closure_loc (ffi_closure*, 346 | ffi_cif *, 347 | void (*fun)(ffi_cif*,void*,void**,void*), 348 | void *user_data, 349 | void*codeloc); 350 | 351 | #ifdef __sgi 352 | # pragma pack 8 353 | #endif 354 | typedef struct { 355 | #if 0 356 | void *trampoline_table; 357 | void *trampoline_table_entry; 358 | #else 359 | char tramp[FFI_TRAMPOLINE_SIZE]; 360 | #endif 361 | ffi_cif *cif; 362 | 363 | #if !FFI_NATIVE_RAW_API 364 | 365 | /* if this is enabled, then a raw closure has the same layout 366 | as a regular closure. We use this to install an intermediate 367 | handler to do the transaltion, void** -> ffi_raw*. */ 368 | 369 | void (*translate_args)(ffi_cif*,void*,void**,void*); 370 | void *this_closure; 371 | 372 | #endif 373 | 374 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*); 375 | void *user_data; 376 | 377 | } ffi_raw_closure; 378 | 379 | typedef struct { 380 | #if 0 381 | void *trampoline_table; 382 | void *trampoline_table_entry; 383 | #else 384 | char tramp[FFI_TRAMPOLINE_SIZE]; 385 | #endif 386 | 387 | ffi_cif *cif; 388 | 389 | #if !FFI_NATIVE_RAW_API 390 | 391 | /* if this is enabled, then a raw closure has the same layout 392 | as a regular closure. We use this to install an intermediate 393 | handler to do the transaltion, void** -> ffi_raw*. */ 394 | 395 | void (*translate_args)(ffi_cif*,void*,void**,void*); 396 | void *this_closure; 397 | 398 | #endif 399 | 400 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); 401 | void *user_data; 402 | 403 | } ffi_java_raw_closure; 404 | 405 | ffi_status 406 | ffi_prep_raw_closure (ffi_raw_closure*, 407 | ffi_cif *cif, 408 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 409 | void *user_data); 410 | 411 | ffi_status 412 | ffi_prep_raw_closure_loc (ffi_raw_closure*, 413 | ffi_cif *cif, 414 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 415 | void *user_data, 416 | void *codeloc); 417 | 418 | ffi_status 419 | ffi_prep_java_raw_closure (ffi_java_raw_closure*, 420 | ffi_cif *cif, 421 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 422 | void *user_data); 423 | 424 | ffi_status 425 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, 426 | ffi_cif *cif, 427 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 428 | void *user_data, 429 | void *codeloc); 430 | 431 | #endif /* FFI_CLOSURES */ 432 | 433 | /* ---- Public interface definition -------------------------------------- */ 434 | 435 | ffi_status ffi_prep_cif(ffi_cif *cif, 436 | ffi_abi abi, 437 | unsigned int nargs, 438 | ffi_type *rtype, 439 | ffi_type **atypes); 440 | 441 | ffi_status ffi_prep_cif_var(ffi_cif *cif, 442 | ffi_abi abi, 443 | unsigned int nfixedargs, 444 | unsigned int ntotalargs, 445 | ffi_type *rtype, 446 | ffi_type **atypes); 447 | 448 | void ffi_call(ffi_cif *cif, 449 | void (*fn)(void), 450 | void *rvalue, 451 | void **avalue); 452 | 453 | /* Useful for eliminating compiler warnings */ 454 | #define FFI_FN(f) ((void (*)(void))f) 455 | 456 | /* ---- Definitions shared with assembly code ---------------------------- */ 457 | 458 | #endif 459 | 460 | /* If these change, update src/mips/ffitarget.h. */ 461 | #define FFI_TYPE_VOID 0 462 | #define FFI_TYPE_INT 1 463 | #define FFI_TYPE_FLOAT 2 464 | #define FFI_TYPE_DOUBLE 3 465 | #if 1 466 | #define FFI_TYPE_LONGDOUBLE 4 467 | #else 468 | #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE 469 | #endif 470 | #define FFI_TYPE_UINT8 5 471 | #define FFI_TYPE_SINT8 6 472 | #define FFI_TYPE_UINT16 7 473 | #define FFI_TYPE_SINT16 8 474 | #define FFI_TYPE_UINT32 9 475 | #define FFI_TYPE_SINT32 10 476 | #define FFI_TYPE_UINT64 11 477 | #define FFI_TYPE_SINT64 12 478 | #define FFI_TYPE_STRUCT 13 479 | #define FFI_TYPE_POINTER 14 480 | #define FFI_TYPE_COMPLEX 15 481 | 482 | /* This should always refer to the last type code (for sanity checks) */ 483 | #define FFI_TYPE_LAST FFI_TYPE_COMPLEX 484 | 485 | #ifdef __cplusplus 486 | } 487 | #endif 488 | 489 | #endif 490 | 491 | 492 | #endif -------------------------------------------------------------------------------- /libffi/ffi_x86_64.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | libffi 3.99999 - Copyright (c) 2011, 2014 Anthony Green 3 | - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the ``Software''), to deal in the Software without 8 | restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* ------------------------------------------------------------------- 28 | Most of the API is documented in doc/libffi.texi. 29 | 30 | The raw API is designed to bypass some of the argument packing and 31 | unpacking on architectures for which it can be avoided. Routines 32 | are provided to emulate the raw API if the underlying platform 33 | doesn't allow faster implementation. 34 | 35 | More details on the raw API can be found in: 36 | 37 | http://gcc.gnu.org/ml/java/1999-q3/msg00138.html 38 | 39 | and 40 | 41 | http://gcc.gnu.org/ml/java/1999-q3/msg00174.html 42 | -------------------------------------------------------------------- */ 43 | 44 | #ifndef LIBFFI_H 45 | #define LIBFFI_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /* Specify which architecture libffi is configured for. */ 52 | #ifndef X86_64 53 | #define X86_64 54 | #endif 55 | 56 | /* ---- System configuration information --------------------------------- */ 57 | 58 | #include 59 | 60 | #ifndef LIBFFI_ASM 61 | 62 | #if defined(_MSC_VER) && !defined(__clang__) 63 | #define __attribute__(X) 64 | #endif 65 | 66 | #include 67 | #include 68 | 69 | /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). 70 | But we can find it either under the correct ANSI name, or under GNU 71 | C's internal name. */ 72 | 73 | #define FFI_64_BIT_MAX 9223372036854775807 74 | 75 | #ifdef LONG_LONG_MAX 76 | # define FFI_LONG_LONG_MAX LONG_LONG_MAX 77 | #else 78 | # ifdef LLONG_MAX 79 | # define FFI_LONG_LONG_MAX LLONG_MAX 80 | # ifdef _AIX52 /* or newer has C99 LLONG_MAX */ 81 | # undef FFI_64_BIT_MAX 82 | # define FFI_64_BIT_MAX 9223372036854775807LL 83 | # endif /* _AIX52 or newer */ 84 | # else 85 | # ifdef __GNUC__ 86 | # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ 87 | # endif 88 | # ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ 89 | # ifndef __PPC64__ 90 | # if defined (__IBMC__) || defined (__IBMCPP__) 91 | # define FFI_LONG_LONG_MAX LONGLONG_MAX 92 | # endif 93 | # endif /* __PPC64__ */ 94 | # undef FFI_64_BIT_MAX 95 | # define FFI_64_BIT_MAX 9223372036854775807LL 96 | # endif 97 | # endif 98 | #endif 99 | 100 | /* The closure code assumes that this works on pointers, i.e. a size_t 101 | can hold a pointer. */ 102 | 103 | typedef struct _ffi_type 104 | { 105 | size_t size; 106 | unsigned short alignment; 107 | unsigned short type; 108 | struct _ffi_type **elements; 109 | } ffi_type; 110 | 111 | #ifndef LIBFFI_HIDE_BASIC_TYPES 112 | #if SCHAR_MAX == 127 113 | # define ffi_type_uchar ffi_type_uint8 114 | # define ffi_type_schar ffi_type_sint8 115 | #else 116 | #error "char size not supported" 117 | #endif 118 | 119 | #if SHRT_MAX == 32767 120 | # define ffi_type_ushort ffi_type_uint16 121 | # define ffi_type_sshort ffi_type_sint16 122 | #elif SHRT_MAX == 2147483647 123 | # define ffi_type_ushort ffi_type_uint32 124 | # define ffi_type_sshort ffi_type_sint32 125 | #else 126 | #error "short size not supported" 127 | #endif 128 | 129 | #if INT_MAX == 32767 130 | # define ffi_type_uint ffi_type_uint16 131 | # define ffi_type_sint ffi_type_sint16 132 | #elif INT_MAX == 2147483647 133 | # define ffi_type_uint ffi_type_uint32 134 | # define ffi_type_sint ffi_type_sint32 135 | #elif INT_MAX == 9223372036854775807 136 | # define ffi_type_uint ffi_type_uint64 137 | # define ffi_type_sint ffi_type_sint64 138 | #else 139 | #error "int size not supported" 140 | #endif 141 | 142 | #if LONG_MAX == 2147483647 143 | # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX 144 | #error "no 64-bit data type supported" 145 | # endif 146 | #elif LONG_MAX != FFI_64_BIT_MAX 147 | #error "long size not supported" 148 | #endif 149 | 150 | #if LONG_MAX == 2147483647 151 | # define ffi_type_ulong ffi_type_uint32 152 | # define ffi_type_slong ffi_type_sint32 153 | #elif LONG_MAX == FFI_64_BIT_MAX 154 | # define ffi_type_ulong ffi_type_uint64 155 | # define ffi_type_slong ffi_type_sint64 156 | #else 157 | #error "long size not supported" 158 | #endif 159 | 160 | /* Need minimal decorations for DLLs to works on Windows. GCC has 161 | autoimport and autoexport. Rely on Libtool to help MSVC export 162 | from a DLL, but always declare data to be imported for MSVC 163 | clients. This costs an extra indirection for MSVC clients using 164 | the static version of the library, but don't worry about that. 165 | Besides, as a workaround, they can define FFI_BUILDING if they 166 | *know* they are going to link with the static library. */ 167 | #if defined _MSC_VER && !defined FFI_BUILDING 168 | #define FFI_EXTERN extern __declspec(dllimport) 169 | #else 170 | #define FFI_EXTERN extern 171 | #endif 172 | 173 | /* These are defined in types.c. */ 174 | FFI_EXTERN ffi_type ffi_type_void; 175 | FFI_EXTERN ffi_type ffi_type_uint8; 176 | FFI_EXTERN ffi_type ffi_type_sint8; 177 | FFI_EXTERN ffi_type ffi_type_uint16; 178 | FFI_EXTERN ffi_type ffi_type_sint16; 179 | FFI_EXTERN ffi_type ffi_type_uint32; 180 | FFI_EXTERN ffi_type ffi_type_sint32; 181 | FFI_EXTERN ffi_type ffi_type_uint64; 182 | FFI_EXTERN ffi_type ffi_type_sint64; 183 | FFI_EXTERN ffi_type ffi_type_float; 184 | FFI_EXTERN ffi_type ffi_type_double; 185 | FFI_EXTERN ffi_type ffi_type_pointer; 186 | 187 | #if 1 188 | FFI_EXTERN ffi_type ffi_type_longdouble; 189 | #else 190 | #define ffi_type_longdouble ffi_type_double 191 | #endif 192 | 193 | #ifdef FFI_TARGET_HAS_COMPLEX_TYPE 194 | FFI_EXTERN ffi_type ffi_type_complex_float; 195 | FFI_EXTERN ffi_type ffi_type_complex_double; 196 | #if 1 197 | FFI_EXTERN ffi_type ffi_type_complex_longdouble; 198 | #else 199 | #define ffi_type_complex_longdouble ffi_type_complex_double 200 | #endif 201 | #endif 202 | #endif /* LIBFFI_HIDE_BASIC_TYPES */ 203 | 204 | typedef enum { 205 | FFI_OK = 0, 206 | FFI_BAD_TYPEDEF, 207 | FFI_BAD_ABI 208 | } ffi_status; 209 | 210 | typedef struct { 211 | ffi_abi abi; 212 | unsigned nargs; 213 | ffi_type **arg_types; 214 | ffi_type *rtype; 215 | unsigned bytes; 216 | unsigned flags; 217 | #ifdef FFI_EXTRA_CIF_FIELDS 218 | FFI_EXTRA_CIF_FIELDS; 219 | #endif 220 | } ffi_cif; 221 | 222 | /* ---- Definitions for the raw API -------------------------------------- */ 223 | 224 | #ifndef FFI_SIZEOF_ARG 225 | # if LONG_MAX == 2147483647 226 | # define FFI_SIZEOF_ARG 4 227 | # elif LONG_MAX == FFI_64_BIT_MAX 228 | # define FFI_SIZEOF_ARG 8 229 | # endif 230 | #endif 231 | 232 | #ifndef FFI_SIZEOF_JAVA_RAW 233 | # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG 234 | #endif 235 | 236 | typedef union { 237 | ffi_sarg sint; 238 | ffi_arg uint; 239 | float flt; 240 | char data[FFI_SIZEOF_ARG]; 241 | void* ptr; 242 | } ffi_raw; 243 | 244 | #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 245 | /* This is a special case for mips64/n32 ABI (and perhaps others) where 246 | sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ 247 | typedef union { 248 | signed int sint; 249 | unsigned int uint; 250 | float flt; 251 | char data[FFI_SIZEOF_JAVA_RAW]; 252 | void* ptr; 253 | } ffi_java_raw; 254 | #else 255 | typedef ffi_raw ffi_java_raw; 256 | #endif 257 | 258 | 259 | void ffi_raw_call (ffi_cif *cif, 260 | void (*fn)(void), 261 | void *rvalue, 262 | ffi_raw *avalue); 263 | 264 | void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); 265 | void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); 266 | size_t ffi_raw_size (ffi_cif *cif); 267 | 268 | /* This is analogous to the raw API, except it uses Java parameter 269 | packing, even on 64-bit machines. I.e. on 64-bit machines longs 270 | and doubles are followed by an empty 64-bit word. */ 271 | 272 | void ffi_java_raw_call (ffi_cif *cif, 273 | void (*fn)(void), 274 | void *rvalue, 275 | ffi_java_raw *avalue); 276 | 277 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); 278 | void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); 279 | size_t ffi_java_raw_size (ffi_cif *cif); 280 | 281 | /* ---- Definitions for closures ----------------------------------------- */ 282 | 283 | #if FFI_CLOSURES 284 | 285 | #ifdef _MSC_VER 286 | __declspec(align(8)) 287 | #endif 288 | typedef struct { 289 | #if 0 290 | void *trampoline_table; 291 | void *trampoline_table_entry; 292 | #else 293 | char tramp[FFI_TRAMPOLINE_SIZE]; 294 | #endif 295 | ffi_cif *cif; 296 | void (*fun)(ffi_cif*,void*,void**,void*); 297 | void *user_data; 298 | } ffi_closure 299 | #ifdef __GNUC__ 300 | __attribute__((aligned (8))) 301 | #endif 302 | ; 303 | 304 | #ifndef __GNUC__ 305 | # ifdef __sgi 306 | # pragma pack 0 307 | # endif 308 | #endif 309 | 310 | void *ffi_closure_alloc (size_t size, void **code); 311 | void ffi_closure_free (void *); 312 | 313 | ffi_status 314 | ffi_prep_closure (ffi_closure*, 315 | ffi_cif *, 316 | void (*fun)(ffi_cif*,void*,void**,void*), 317 | void *user_data) 318 | __attribute__((deprecated ("use ffi_prep_closure_loc instead"))); 319 | 320 | ffi_status 321 | ffi_prep_closure_loc (ffi_closure*, 322 | ffi_cif *, 323 | void (*fun)(ffi_cif*,void*,void**,void*), 324 | void *user_data, 325 | void*codeloc); 326 | 327 | #ifdef __sgi 328 | # pragma pack 8 329 | #endif 330 | typedef struct { 331 | #if 0 332 | void *trampoline_table; 333 | void *trampoline_table_entry; 334 | #else 335 | char tramp[FFI_TRAMPOLINE_SIZE]; 336 | #endif 337 | ffi_cif *cif; 338 | 339 | #if !FFI_NATIVE_RAW_API 340 | 341 | /* If this is enabled, then a raw closure has the same layout 342 | as a regular closure. We use this to install an intermediate 343 | handler to do the transaltion, void** -> ffi_raw*. */ 344 | 345 | void (*translate_args)(ffi_cif*,void*,void**,void*); 346 | void *this_closure; 347 | 348 | #endif 349 | 350 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*); 351 | void *user_data; 352 | 353 | } ffi_raw_closure; 354 | 355 | typedef struct { 356 | #if 0 357 | void *trampoline_table; 358 | void *trampoline_table_entry; 359 | #else 360 | char tramp[FFI_TRAMPOLINE_SIZE]; 361 | #endif 362 | 363 | ffi_cif *cif; 364 | 365 | #if !FFI_NATIVE_RAW_API 366 | 367 | /* If this is enabled, then a raw closure has the same layout 368 | as a regular closure. We use this to install an intermediate 369 | handler to do the translation, void** -> ffi_raw*. */ 370 | 371 | void (*translate_args)(ffi_cif*,void*,void**,void*); 372 | void *this_closure; 373 | 374 | #endif 375 | 376 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); 377 | void *user_data; 378 | 379 | } ffi_java_raw_closure; 380 | 381 | ffi_status 382 | ffi_prep_raw_closure (ffi_raw_closure*, 383 | ffi_cif *cif, 384 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 385 | void *user_data); 386 | 387 | ffi_status 388 | ffi_prep_raw_closure_loc (ffi_raw_closure*, 389 | ffi_cif *cif, 390 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 391 | void *user_data, 392 | void *codeloc); 393 | 394 | ffi_status 395 | ffi_prep_java_raw_closure (ffi_java_raw_closure*, 396 | ffi_cif *cif, 397 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 398 | void *user_data); 399 | 400 | ffi_status 401 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, 402 | ffi_cif *cif, 403 | void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), 404 | void *user_data, 405 | void *codeloc); 406 | 407 | #endif /* FFI_CLOSURES */ 408 | 409 | #if FFI_GO_CLOSURES 410 | 411 | typedef struct { 412 | void *tramp; 413 | ffi_cif *cif; 414 | void (*fun)(ffi_cif*,void*,void**,void*); 415 | } ffi_go_closure; 416 | 417 | ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, 418 | void (*fun)(ffi_cif*,void*,void**,void*)); 419 | 420 | void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, 421 | void **avalue, void *closure); 422 | 423 | #endif /* FFI_GO_CLOSURES */ 424 | 425 | /* ---- Public interface definition -------------------------------------- */ 426 | 427 | ffi_status ffi_prep_cif(ffi_cif *cif, 428 | ffi_abi abi, 429 | unsigned int nargs, 430 | ffi_type *rtype, 431 | ffi_type **atypes); 432 | 433 | ffi_status ffi_prep_cif_var(ffi_cif *cif, 434 | ffi_abi abi, 435 | unsigned int nfixedargs, 436 | unsigned int ntotalargs, 437 | ffi_type *rtype, 438 | ffi_type **atypes); 439 | 440 | void ffi_call(ffi_cif *cif, 441 | void (*fn)(void), 442 | void *rvalue, 443 | void **avalue); 444 | 445 | ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, 446 | size_t *offsets); 447 | 448 | /* Useful for eliminating compiler warnings. */ 449 | #define FFI_FN(f) ((void (*)(void))f) 450 | 451 | /* ---- Definitions shared with assembly code ---------------------------- */ 452 | 453 | #endif 454 | 455 | /* If these change, update src/mips/ffitarget.h. */ 456 | #define FFI_TYPE_VOID 0 457 | #define FFI_TYPE_INT 1 458 | #define FFI_TYPE_FLOAT 2 459 | #define FFI_TYPE_DOUBLE 3 460 | #if 1 461 | #define FFI_TYPE_LONGDOUBLE 4 462 | #else 463 | #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE 464 | #endif 465 | #define FFI_TYPE_UINT8 5 466 | #define FFI_TYPE_SINT8 6 467 | #define FFI_TYPE_UINT16 7 468 | #define FFI_TYPE_SINT16 8 469 | #define FFI_TYPE_UINT32 9 470 | #define FFI_TYPE_SINT32 10 471 | #define FFI_TYPE_UINT64 11 472 | #define FFI_TYPE_SINT64 12 473 | #define FFI_TYPE_STRUCT 13 474 | #define FFI_TYPE_POINTER 14 475 | #define FFI_TYPE_COMPLEX 15 476 | 477 | /* This should always refer to the last type code (for sanity checks). */ 478 | #define FFI_TYPE_LAST FFI_TYPE_COMPLEX 479 | 480 | #ifdef __cplusplus 481 | } 482 | #endif 483 | 484 | #endif 485 | -------------------------------------------------------------------------------- /libffi/ffitarget.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | #include "ffitarget_arm64.h" 4 | 5 | 6 | #endif 7 | #ifdef __i386__ 8 | 9 | #include 10 | 11 | 12 | #endif 13 | #ifdef __arm__ 14 | 15 | #include 16 | 17 | 18 | #endif 19 | #ifdef __x86_64__ 20 | 21 | #include 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /libffi/ffitarget_arm.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | ffitarget.h - Copyright (c) 2012 Anthony Green 3 | Copyright (c) 2010 CodeSourcery 4 | Copyright (c) 1996-2003 Red Hat, Inc. 5 | 6 | Target configuration macros for ARM. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | ``Software''), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included 17 | in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | 28 | ----------------------------------------------------------------------- */ 29 | 30 | #ifndef LIBFFI_TARGET_H 31 | #define LIBFFI_TARGET_H 32 | 33 | #ifndef LIBFFI_H 34 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 35 | #endif 36 | 37 | #ifndef LIBFFI_ASM 38 | typedef unsigned long ffi_arg; 39 | typedef signed long ffi_sarg; 40 | 41 | typedef enum ffi_abi { 42 | FFI_FIRST_ABI = 0, 43 | FFI_SYSV, 44 | FFI_VFP, 45 | FFI_LAST_ABI, 46 | #ifdef __ARM_PCS_VFP 47 | FFI_DEFAULT_ABI = FFI_VFP, 48 | #else 49 | FFI_DEFAULT_ABI = FFI_SYSV, 50 | #endif 51 | } ffi_abi; 52 | #endif 53 | 54 | #define FFI_EXTRA_CIF_FIELDS \ 55 | int vfp_used; \ 56 | unsigned short vfp_reg_free, vfp_nargs; \ 57 | signed char vfp_args[16] \ 58 | 59 | #define FFI_TARGET_SPECIFIC_VARIADIC 60 | #define FFI_TARGET_HAS_COMPLEX_TYPE 61 | 62 | /* ---- Definitions for closures ----------------------------------------- */ 63 | 64 | #define FFI_CLOSURES 1 65 | #define FFI_GO_CLOSURES 1 66 | #define FFI_NATIVE_RAW_API 0 67 | 68 | #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE 69 | 70 | #ifdef __MACH__ 71 | #define FFI_TRAMPOLINE_SIZE 12 72 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET 8 73 | #else 74 | #error "No trampoline table implementation" 75 | #endif 76 | 77 | #else 78 | #define FFI_TRAMPOLINE_SIZE 12 79 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /libffi/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | ``Software''), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #ifndef LIBFFI_TARGET_H 23 | #define LIBFFI_TARGET_H 24 | 25 | #ifndef LIBFFI_H 26 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 27 | #endif 28 | 29 | #ifndef LIBFFI_ASM 30 | #ifdef __ILP32__ 31 | #define FFI_SIZEOF_ARG 8 32 | #define FFI_SIZEOF_JAVA_RAW 4 33 | typedef unsigned long long ffi_arg; 34 | typedef signed long long ffi_sarg; 35 | #else 36 | typedef unsigned long ffi_arg; 37 | typedef signed long ffi_sarg; 38 | #endif 39 | 40 | typedef enum ffi_abi 41 | { 42 | FFI_FIRST_ABI = 0, 43 | FFI_SYSV, 44 | FFI_LAST_ABI, 45 | FFI_DEFAULT_ABI = FFI_SYSV 46 | } ffi_abi; 47 | #endif 48 | 49 | /* ---- Definitions for closures ----------------------------------------- */ 50 | 51 | #define FFI_CLOSURES 1 52 | #define FFI_NATIVE_RAW_API 0 53 | 54 | #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE 55 | 56 | #ifdef __MACH__ 57 | #define FFI_TRAMPOLINE_SIZE 16 58 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET 16 59 | #else 60 | #error "No trampoline table implementation" 61 | #endif 62 | 63 | #else 64 | #define FFI_TRAMPOLINE_SIZE 24 65 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE 66 | #endif 67 | 68 | /* ---- Internal ---- */ 69 | 70 | #if defined (__APPLE__) 71 | #define FFI_TARGET_SPECIFIC_VARIADIC 72 | #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs 73 | #else 74 | /* iOS reserves x18 for the system. Disable Go closures until 75 | a new static chain is chosen. */ 76 | #define FFI_GO_CLOSURES 1 77 | #endif 78 | 79 | #define FFI_TARGET_HAS_COMPLEX_TYPE 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /libffi/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | #ifdef __i386__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | ffitarget.h - Copyright (c) 2012, 2014 Anthony Green 5 | Copyright (c) 1996-2003, 2010 Red Hat, Inc. 6 | Copyright (C) 2008 Free Software Foundation, Inc. 7 | 8 | Target configuration macros for x86 and x86-64. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | ``Software''), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | ----------------------------------------------------------------------- */ 31 | 32 | #ifndef LIBFFI_TARGET_H 33 | #define LIBFFI_TARGET_H 34 | 35 | #ifndef LIBFFI_H 36 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 37 | #endif 38 | 39 | /* ---- System specific configurations ----------------------------------- */ 40 | 41 | /* For code common to all platforms on x86 and x86_64. */ 42 | #define X86_ANY 43 | 44 | #if defined (X86_64) && defined (__i386__) 45 | #undef X86_64 46 | #define X86 47 | #endif 48 | 49 | #ifdef X86_WIN64 50 | #define FFI_SIZEOF_ARG 8 51 | #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ 52 | #endif 53 | 54 | #define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 55 | #define FFI_TARGET_HAS_COMPLEX_TYPE 56 | 57 | /* ---- Generic type definitions ----------------------------------------- */ 58 | 59 | #ifndef LIBFFI_ASM 60 | #ifdef X86_WIN64 61 | #ifdef _MSC_VER 62 | typedef unsigned __int64 ffi_arg; 63 | typedef __int64 ffi_sarg; 64 | #else 65 | typedef unsigned long long ffi_arg; 66 | typedef long long ffi_sarg; 67 | #endif 68 | #else 69 | #if defined __x86_64__ && defined __ILP32__ 70 | #define FFI_SIZEOF_ARG 8 71 | #define FFI_SIZEOF_JAVA_RAW 4 72 | typedef unsigned long long ffi_arg; 73 | typedef long long ffi_sarg; 74 | #else 75 | typedef unsigned long ffi_arg; 76 | typedef signed long ffi_sarg; 77 | #endif 78 | #endif 79 | 80 | typedef enum ffi_abi { 81 | FFI_FIRST_ABI = 0, 82 | 83 | /* ---- Intel x86 Win32 ---------- */ 84 | #ifdef X86_WIN32 85 | FFI_SYSV, 86 | FFI_STDCALL, 87 | FFI_THISCALL, 88 | FFI_FASTCALL, 89 | FFI_MS_CDECL, 90 | FFI_PASCAL, 91 | FFI_REGISTER, 92 | FFI_LAST_ABI, 93 | #ifdef _MSC_VER 94 | FFI_DEFAULT_ABI = FFI_MS_CDECL 95 | #else 96 | FFI_DEFAULT_ABI = FFI_SYSV 97 | #endif 98 | 99 | #elif defined(X86_WIN64) 100 | FFI_WIN64, 101 | FFI_LAST_ABI, 102 | FFI_DEFAULT_ABI = FFI_WIN64 103 | 104 | #else 105 | /* ---- Intel x86 and AMD x86-64 - */ 106 | FFI_SYSV, 107 | FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ 108 | FFI_THISCALL, 109 | FFI_FASTCALL, 110 | FFI_STDCALL, 111 | FFI_PASCAL, 112 | FFI_REGISTER, 113 | FFI_LAST_ABI, 114 | #if defined(__i386__) || defined(__i386) 115 | FFI_DEFAULT_ABI = FFI_SYSV 116 | #else 117 | FFI_DEFAULT_ABI = FFI_UNIX64 118 | #endif 119 | #endif 120 | } ffi_abi; 121 | #endif 122 | 123 | /* ---- Definitions for closures ----------------------------------------- */ 124 | 125 | #define FFI_CLOSURES 1 126 | #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) 127 | #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) 128 | #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) 129 | #define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) 130 | 131 | #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) 132 | #define FFI_TRAMPOLINE_SIZE 24 133 | #define FFI_NATIVE_RAW_API 0 134 | #else 135 | #ifdef X86_WIN32 136 | #define FFI_TRAMPOLINE_SIZE 52 137 | #else 138 | #ifdef X86_WIN64 139 | #define FFI_TRAMPOLINE_SIZE 29 140 | #define FFI_NATIVE_RAW_API 0 141 | #define FFI_NO_RAW_API 1 142 | #else 143 | #define FFI_TRAMPOLINE_SIZE 10 144 | #endif 145 | #endif 146 | #ifndef X86_WIN64 147 | #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ 148 | #endif 149 | #endif 150 | 151 | #endif 152 | 153 | 154 | 155 | #endif -------------------------------------------------------------------------------- /libffi/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | /* -----------------------------------------------------------------*-C-*- 2 | ffitarget.h - Copyright (c) 2012, 2014 Anthony Green 3 | Copyright (c) 1996-2003, 2010 Red Hat, Inc. 4 | Copyright (C) 2008 Free Software Foundation, Inc. 5 | 6 | Target configuration macros for x86 and x86-64. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | ``Software''), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included 17 | in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | 28 | ----------------------------------------------------------------------- */ 29 | 30 | #ifndef LIBFFI_TARGET_H 31 | #define LIBFFI_TARGET_H 32 | 33 | #ifndef LIBFFI_H 34 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 35 | #endif 36 | 37 | /* ---- System specific configurations ----------------------------------- */ 38 | 39 | /* For code common to all platforms on x86 and x86_64. */ 40 | #define X86_ANY 41 | 42 | #if defined (X86_64) && defined (__i386__) 43 | #undef X86_64 44 | #define X86 45 | #endif 46 | 47 | #ifdef X86_WIN64 48 | #define FFI_SIZEOF_ARG 8 49 | #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ 50 | #endif 51 | 52 | #define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 53 | #ifndef _MSC_VER 54 | #define FFI_TARGET_HAS_COMPLEX_TYPE 55 | #endif 56 | 57 | /* ---- Generic type definitions ----------------------------------------- */ 58 | 59 | #ifndef LIBFFI_ASM 60 | #ifdef X86_WIN64 61 | #ifdef _MSC_VER 62 | typedef unsigned __int64 ffi_arg; 63 | typedef __int64 ffi_sarg; 64 | #else 65 | typedef unsigned long long ffi_arg; 66 | typedef long long ffi_sarg; 67 | #endif 68 | #else 69 | #if defined __x86_64__ && defined __ILP32__ 70 | #define FFI_SIZEOF_ARG 8 71 | #define FFI_SIZEOF_JAVA_RAW 4 72 | typedef unsigned long long ffi_arg; 73 | typedef long long ffi_sarg; 74 | #else 75 | typedef unsigned long ffi_arg; 76 | typedef signed long ffi_sarg; 77 | #endif 78 | #endif 79 | 80 | typedef enum ffi_abi { 81 | #if defined(X86_WIN64) 82 | FFI_FIRST_ABI = 0, 83 | FFI_WIN64, 84 | FFI_LAST_ABI, 85 | FFI_DEFAULT_ABI = FFI_WIN64 86 | 87 | #elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) 88 | FFI_FIRST_ABI = 1, 89 | FFI_UNIX64, 90 | FFI_WIN64, 91 | FFI_EFI64 = FFI_WIN64, 92 | FFI_LAST_ABI, 93 | FFI_DEFAULT_ABI = FFI_UNIX64 94 | 95 | #elif defined(X86_WIN32) 96 | FFI_FIRST_ABI = 0, 97 | FFI_SYSV = 1, 98 | FFI_STDCALL = 2, 99 | FFI_THISCALL = 3, 100 | FFI_FASTCALL = 4, 101 | FFI_MS_CDECL = 5, 102 | FFI_PASCAL = 6, 103 | FFI_REGISTER = 7, 104 | FFI_LAST_ABI, 105 | FFI_DEFAULT_ABI = FFI_MS_CDECL 106 | #else 107 | FFI_FIRST_ABI = 0, 108 | FFI_SYSV = 1, 109 | FFI_THISCALL = 3, 110 | FFI_FASTCALL = 4, 111 | FFI_STDCALL = 5, 112 | FFI_PASCAL = 6, 113 | FFI_REGISTER = 7, 114 | FFI_MS_CDECL = 8, 115 | FFI_LAST_ABI, 116 | FFI_DEFAULT_ABI = FFI_SYSV 117 | #endif 118 | } ffi_abi; 119 | #endif 120 | 121 | /* ---- Definitions for closures ----------------------------------------- */ 122 | 123 | #define FFI_CLOSURES 1 124 | #define FFI_GO_CLOSURES 1 125 | 126 | #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) 127 | #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) 128 | #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) 129 | #define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) 130 | 131 | #if defined (X86_64) || defined(X86_WIN64) \ 132 | || (defined (__x86_64__) && defined (X86_DARWIN)) 133 | # define FFI_TRAMPOLINE_SIZE 24 134 | # define FFI_NATIVE_RAW_API 0 135 | #else 136 | # define FFI_TRAMPOLINE_SIZE 12 137 | # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ 138 | #endif 139 | 140 | #endif 141 | 142 | -------------------------------------------------------------------------------- /libffi/libffi.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnyxx/libffi-iOS/c99de7586d22b9b35100d098a37ed42cb75e26dc/libffi/libffi.a --------------------------------------------------------------------------------