Actually, we are using our own initializer and finalizer functions: MainClass.h
void initializer (void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer);
void finalizer(void* extData);
And MainClass.cpp (or MainClass.m, doesn’t seem to matter about the extension cpp or m):
FREObject setContext (FREContext ctx, void* funcData, uint32_t argc, FREObject argv)
pContext = ctx;
FREObject getFive (FREContext ctx, void* funcData, uint32_t argc, FREObject argv)
int32_t x = 5;
FRENewObjectFromInt32 (x, &freX);
void contextInitializer (void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctions, const FRENamedFunction** functions)
*numFunctions = 2;
FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * (*numFunctions));
func.name = (const uint8_t*) "setContext";
func.functionData = NULL;
func.function = &setContext;
func.name = (const uint8_t*) "getFive";
func.functionData = NULL;
func.function = &getFive;
*functions = func;
void contextFinalizer (FREContext ctx)
void initializer (void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer)
*ctxInitializer = &contextInitializer;
*ctxFinalizer = &contextFinalizer;
void finalizer (void* extData)
This works perfectly. I can create an IPA and push it on to the iPad.
This is just from creating a Cocao Static Touch library, with the two files above and adding in the “FlashRuntimeExtensions.h” via the “Add Files to” context menu item in XCode. I don’t need to touch any XCode settings at all.
Now, if I could only figure out how to add the simplest bit of Juce into this, I would be set…Just a simple function that returns a Juce String and requires only the juce_core module. I have tried exhaustively to accomplish this but the library just won’t build this way.
Coming at it the other way, I have tried to use the introjucer in Windows (it won’t build on my Mac) to set up an iOS static library project with just the core module included. Then I add in the adobe stuff and it builds just fine (except for the disconcerting fact that the .a file shows in red and I have to hunt for it, which I believe you said was a bug in another post). I can even create a native extension with it. It is when I try to create an IPA using Adobe’s adt tool, that we get the error:
[quote]ld warning: unexpected srelocation type 9
"_finalizer", referenced from:
_g_com_adobe_air_fre_fmap in extensioglue.o
"_initializer", referenced from:
_g_com_adobe_air_fre_fmap in extensioglue.o[/quote]
Now, for my experience level there are just too many unknown variables and places where things could be going wrong. It could be some adobe argument or something in XCode. It could be a major oversight or a tiny little bug or maybe it is not even possible to combine adbobe’s native extensions with Juce on the iPad. I have spent about 40 hours now trying to figure this all out.
So in short, if I could just get a complete noob breakdown of just how to add the juce core module to a Cocoa Static Touch project, I would be very grateful. This would really help me narrow it down.