Last active
January 13, 2016 07:28
-
-
Save gistya/6292bc9f57e9c56469b1 to your computer and use it in GitHub Desktop.
clangFoo! Makes -ObjC flag unnecessary by faking clang into linking classes from a j2objc static library your transpiled code wants to dynamically load but otherwise can't during runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** by Jon Gilbert gistya at gmail **/ | |
/** NoObjCLinkerFlag.h **/ | |
#import <Foundation/Foundation.h> | |
/*!@description Call this function once from somewhere in your lib, and the compiler | |
will be tricked into loading the classes mentioned in clangFoo below. */ | |
void preloadXalanDynamicLoads(); | |
@interface NoObjCLinkerFlag:NSObject | |
@end | |
/** NoObjCLinkerFlag.m **/ | |
#import "NoObjCLinkerFlag.h" | |
#import "org/apache/xalan/processor/TransformerFactoryImpl.h" | |
#import "org/apache/xml/serializer/ToXMLStream.h" | |
void preloadXalanDynamicLoads(){} | |
@implementation NoObjCLinkerFlag:NSObject | |
/*! @description This method never actually gets called. */ | |
- (void)clangFoo { | |
OrgApacheXalanProcessorTransformerFactoryImpl_class_(); | |
OrgApacheXmlSerializerToXMLStream_class_(); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment