Skip to content

Commit 0d676e2

Browse files
committed
Add FLEX_DISABLE_CTORS, close #471
1 parent fcca09e commit 0d676e2

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

Classes/Utility/FLEXUtility.m

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,21 @@
1515
#import <zlib.h>
1616

1717
BOOL FLEXConstructorsShouldRun() {
18-
static BOOL _FLEXConstructorsShouldRun_storage = YES;
19-
20-
static dispatch_once_t onceToken;
21-
dispatch_once(&onceToken, ^{
22-
NSString *key = @"FLEX_SKIP_INIT";
23-
if (getenv(key.UTF8String) || [NSUserDefaults.standardUserDefaults boolForKey:key]) {
24-
_FLEXConstructorsShouldRun_storage = NO;
25-
}
26-
});
27-
28-
return _FLEXConstructorsShouldRun_storage;
18+
#if FLEX_DISABLE_CTORS
19+
return NO;
20+
#else
21+
static BOOL _FLEXConstructorsShouldRun_storage = YES;
22+
23+
static dispatch_once_t onceToken;
24+
dispatch_once(&onceToken, ^{
25+
NSString *key = @"FLEX_SKIP_INIT";
26+
if (getenv(key.UTF8String) || [NSUserDefaults.standardUserDefaults boolForKey:key]) {
27+
_FLEXConstructorsShouldRun_storage = NO;
28+
}
29+
});
30+
31+
return _FLEXConstructorsShouldRun_storage;
32+
#endif
2933
}
3034

3135
@implementation FLEXUtility

0 commit comments

Comments
 (0)