diff --git a/React/Executors/RCTJSCWrapper.h b/React/Executors/RCTJSCWrapper.h index 68ddb46c1..e112320cb 100644 --- a/React/Executors/RCTJSCWrapper.h +++ b/React/Executors/RCTJSCWrapper.h @@ -27,6 +27,13 @@ typedef bool (*JSValueIsNullFuncType)(JSContextRef, JSValueRef); typedef JSValueRef (*JSEvaluateScriptFuncType)(JSContextRef, JSStringRef, JSObjectRef, JSStringRef, int, JSValueRef *); typedef JSValueRef (*JSEvaluateBytecodeBundleFuncType)(JSContextRef, JSObjectRef, int, JSStringRef, JSValueRef *); +/** + * JSNoBytecodeFileFormatVersion + * + * Version number indicating that bytecode is not supported by this runtime. + */ +extern const int32_t JSNoBytecodeFileFormatVersion; + typedef struct RCTJSCWrapper { JSStringCreateWithCFStringFuncType JSStringCreateWithCFString; JSStringCreateWithUTF8CStringFuncType JSStringCreateWithUTF8CString; @@ -43,6 +50,7 @@ typedef struct RCTJSCWrapper { JSValueIsNullFuncType JSValueIsNull; JSEvaluateScriptFuncType JSEvaluateScript; JSEvaluateBytecodeBundleFuncType JSEvaluateBytecodeBundle; + const int32_t JSBytecodeFileFormatVersion; Class JSContext; Class JSValue; } RCTJSCWrapper; diff --git a/React/Executors/RCTJSCWrapper.mm b/React/Executors/RCTJSCWrapper.mm index d7d3c95d3..625d430a6 100644 --- a/React/Executors/RCTJSCWrapper.mm +++ b/React/Executors/RCTJSCWrapper.mm @@ -41,6 +41,8 @@ static void *RCTCustomLibraryHandler(void) return handler; } +const int32_t JSNoBytecodeFileFormatVersion = -1; + static RCTJSCWrapper *RCTSetUpSystemLibraryPointers() { return new RCTJSCWrapper { @@ -59,6 +61,7 @@ static RCTJSCWrapper *RCTSetUpSystemLibraryPointers() .JSValueIsNull = JSValueIsNull, .JSEvaluateScript = JSEvaluateScript, .JSEvaluateBytecodeBundle = NULL, + .JSBytecodeFileFormatVersion = JSNoBytecodeFileFormatVersion, .JSContext = [JSContext class], .JSValue = [JSValue class], }; @@ -87,6 +90,7 @@ static RCTJSCWrapper *RCTSetUpCustomLibraryPointers() .JSValueIsNull = (JSValueIsNullFuncType)dlsym(libraryHandle, "JSValueIsNull"), .JSEvaluateScript = (JSEvaluateScriptFuncType)dlsym(libraryHandle, "JSEvaluateScript"), .JSEvaluateBytecodeBundle = (JSEvaluateBytecodeBundleFuncType)dlsym(libraryHandle, "JSEvaluateBytecodeBundle"), + .JSBytecodeFileFormatVersion = *(const int32_t *)dlsym(libraryHandle, "JSBytecodeFileFormatVersion"), .JSContext = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSContext"), .JSValue = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSValue"), };