diff --git a/React/Executors/RCTJSCWrapper.h b/React/Executors/RCTJSCWrapper.h index 7ae6f0b2b..20560800e 100644 --- a/React/Executors/RCTJSCWrapper.h +++ b/React/Executors/RCTJSCWrapper.h @@ -49,3 +49,13 @@ typedef struct RCTJSCWrapper { RCT_EXTERN RCTJSCWrapper *RCTJSCWrapperCreate(BOOL useCustomJSC); RCT_EXTERN void RCTJSCWrapperRelease(RCTJSCWrapper *wrapper); + +/** + * Link time overridable initialization function to execute custom + * initialization code when loading custom JSC. + * + * By default it does nothing. + * + * @param handle to the dlopen'd JSC library. + */ +void __attribute__((visibility("hidden"))) RCTCustomJSCInit(void *handle); diff --git a/React/Executors/RCTJSCWrapper.mm b/React/Executors/RCTJSCWrapper.mm index 27c534843..ec023387a 100644 --- a/React/Executors/RCTJSCWrapper.mm +++ b/React/Executors/RCTJSCWrapper.mm @@ -16,11 +16,10 @@ #include -#if HAS_FBGLOG -#import -typedef void (*configureJSCLoggingForIOSFuncType)(int32_t, std::unique_ptr, void (*)()); -#endif +void __attribute__((visibility("hidden"),weak)) RCTCustomJSCInit(void *handle) { + return; +} static void *RCTCustomLibraryHandler(void) { @@ -89,17 +88,10 @@ static void RCTSetUpCustomLibraryPointers(RCTJSCWrapper *wrapper) wrapper->JSValue = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSValue"); wrapper->configureJSContextForIOS = (configureJSContextForIOSFuncType)dlsym(libraryHandle, "configureJSContextForIOS"); -#if HAS_FBGLOG static dispatch_once_t once; dispatch_once(&once, ^{ - void *handle = dlsym(libraryHandle, "configureJSCLoggingForIOS"); - - if (handle) { - configureJSCLoggingForIOSFuncType logConfigFunc = (configureJSCLoggingForIOSFuncType)handle; - logConfigFunc(google::GLOG_INFO, FBGLogSink(), FBGLogFailureFunction); - } + RCTCustomJSCInit(libraryHandle); }); -#endif } RCTJSCWrapper *RCTJSCWrapperCreate(BOOL useCustomJSC)