Differences From Artifact [18cd3f3736]:
- File
src/init.mm
— part of check-in
[1ee33c9983]
at
2024-08-03 14:50:31
on branch trunk
— Don't depend on global constructors for commands
This breaks when using ObjC, as these can run before the ObjC module is initialized, resulting in non-working message sends as the selectors are not registered yet. (user: js, size: 338) [annotate] [blame] [check-ins using]
To Artifact [79aa5cd4bd]:
- File src/init.mm — part of check-in [d4f57c85c4] at 2025-03-02 14:56:47 on branch trunk — Clean up enqueueInit (user: js, size: 336) [annotate] [blame] [check-ins using]
1 2 3 4 5 | #include <vector> #import "cube.h" #import "protos.h" | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <vector> #import "cube.h" #import "protos.h" static OFMutableArray<void (^)(void)> *queue; void enqueueInit(void (^init)(void)) { if (queue == nil) queue = [[OFMutableArray alloc] init]; [queue addObject:init]; } void processInitQueue(void) { for (void (^init)(void) in queue) init(); [queue removeAllObjects]; } |