I'm trying to resolve the error "The extension context does not have a method with the name ____" for a mac-based native extension.
To isolate the problem, I built a simple .framework, following the documented steps including the flat_namespace and weak_framework tags. Happy to provide full build settings if that's helpful.
Here's the description file I use to build the ANE:
<?xml version="1.0" ?><extension xmlns="http://ns.adobe.com/air/extension/3.1"><id>com.example.extensions.Test</id><versionNumber>1.0</versionNumber><platforms> <platform name="MacOS-x86"> <applicationDeployment> <nativeLibrary>Test.framework</nativeLibrary> <initializer>FWInitializer</initializer> <finalizer>FWFinalizer</finalizer> </applicationDeployment> </platform></platforms></extension>
To make sure this is not the issue of Flash Builder 4.6, I took the workaround steps detailed here:
Here's the framework side:
uint32_t isSupportedInOS = 1; FREObject getHelloWorld(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { FREObject result; const char *str = "Hello World!! This is your DLL talking!"; FRENewObjectFromUTF8((uint32_t)strlen(str)+1, (const uint8_t *)str, &result); return result; } FREObject isSupported(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { FREObject result; FRENewObjectFromBool( isSupportedInOS, &result); return result; } 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[0].name = (const uint8_t*) "isSupported"; func[0].functionData = NULL; func[0].function = &isSupported; func[1].name = (const uint8_t*) "getHelloWorld"; func[1].functionData = NULL; func[1].function = &getHelloWorld; *functions = func; } void contextFinalizer(FREContext ctx) { return; } void FWInitializer(void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer) { extData = NULL;// added *ctxInitializer = &contextInitializer; *ctxFinalizer = &contextFinalizer; } void FWFinalizer(void* extData) { return; }
This is compiled as a i386 framework (using LLVM 5.1 – I know they recommend GCC, but it worked for me before for this exact case). I create the ANE as follows:
export PATH=$PATH:/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0/bin JAR -xf TestSDK.swc catalog.xml library.swf adt -package -target and Test.ane description.xml -swc TestSDK.swc -platform MacOS-x86 library.swf Test.framework
It seems as if the initializer never gets called. I know I got it to work this way before, but I've spent hours without any progress trying to figure out what's wrong in this setup. Any help is greatly appreciated.