Copy link to clipboard
Copied
This thread is for discussion of the 64-bit development build of AIR for OSX. This feature is currently not available on labs.adobe.com and is distributed privately for those developers that are interested in providing feedback. If you would like to help us test this upcoming feature (release date not announced), please drop a line to ccampbel@adobe.com.
Because this is on the bleeding edge, we're going to do something slightly different for bug reporting. For the time being, please post any bugs related to this feature (or these development builds) to this thread or via email (ccampbel@adobe.com). We're going to keep the bugs off of bugbase.adobe.com for the time being. We'll make sure to update everyone when this changes (which will probably be when this goes to the official beta on labs.) If your project/work needs to remain private, please feel free to send me the bug report and attachments in email and I'll make sure they get to the right internal people only.
Thanks and we're excited to hear what you have to say.
Copy link to clipboard
Copied
Hi Daisuke,
I've managed to put together a simple ANE that works fine with AIR 64 bit. Below you'll find a cmake script for an xcode framework project that can help you to get started quickly. I can send you the sample app with sources too if you need them.
cmake_minimum_required (VERSION 2.8.11)
project (HelloANE)
set(CMAKE_MACOSX_RPATH 1)
# Overwrite default install directory
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/..)
add_library(HelloANE SHARED HelloANE.cpp HelloANE.h)
set(HelloANE_VER A)
set_target_properties(HelloANE PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${HelloANE_VER}
PUBLIC_HEADER "HelloANE.h;"
# Load dynamic libraries from these folders:
INSTALL_RPATH "@executable_path/../runtimes/air/mac;@executable_path/../Frameworks;/Library/Frameworks;"
DEBUG_POSTFIX -d
)
include_directories(/AIRSDK/include)
set(AIR_64_LIB /AIRSDK/runtimes/air/mac/Adobe\ AIR.framework/Versions/1.0/Adobe\ AIR_64)
target_link_libraries(HelloANE LINK_PUBLIC ${AIR_64_LIB})
install(TARGETS HelloANE
FRAMEWORK DESTINATION build
LIBRARY DESTINATION build
ARCHIVE DESTINATION build
# These are ignored on the Mac... and things are automatically placed in
# their appropriate Framework sub-folder at build time. (And then the built
# framework is copied recursively when it is installed.)
PRIVATE_HEADER DESTINATION share/HelloANE-${HelloANE_VER}/PrivateHeaders
PUBLIC_HEADER DESTINATION include/HelloANE-${HelloANE_VER}
RESOURCE DESTINATION share/HelloANE-${HelloANE_VER}/Resources
# But they are required to be present so that installing a framework on other
# other platforms will install the pieces of the framework without having to
# duplicate install rules for the pieces of the framework.
)
Copy link to clipboard
Copied
Hi Balazs,
Copy link to clipboard
Copied
Hi Daisuke, here you are:
Copy link to clipboard
Copied
Hi, Balazs,
Thank you for sending the sample code.
As was in the Readme.md, I have to change the path of the SDK.
However, an error in the build can not be solved only one in ZERO_CHECK.build in XCode.
xcode of the error message is this.
----
PhaseScriptExecution CMake\ Rules /Users/nakagawa/Desktop/project/helloane/xcode/build/HelloANE.build/Debug/ZERO_CHECK.build/Script-B9910E3F75144B689055F5DB.sh
cd /Users/balazsforian-szabo/Documents/Projects/c/HelloANE/src
/bin/sh -c /Users/nakagawa/Desktop/project/helloane/xcode/build/HelloANE.build/Debug/ZERO_CHECK.build/Script-B9910E3F75144B689055F5DB.sh
error: can't change directory to '/Users/balazsforian-szabo/Documents/Projects/c/HelloANE/src' (No such file or directory)
---
I have changed the path, in the Build Phases-CMake PostBuild Rules of each TAEGETS on XCode.
In addition, cmake_install.cmake, CMakeLists.txt, CMakeCache.txt, and in each file of CMakeScripts folder, it has changed the path.
I wonder if I have forgotten fix what?
thx.
Copy link to clipboard
Copied
Hi Daisuke,
The easiest way to overcome this issue is to delete the entire XCode / VS project and generate it again with CMake. Before running CMake, make sure that you update the AIR SDK path in src/CMakeLists.txt.
If you're not familiar with CMake, then here is a really quick introduction: Setting Up a Cross-Platform C++ Environment
Thanks for your feedback, I've updated the README file of the sample code.
Copy link to clipboard
Copied
Hi, Balazs
Thank you for what you gave me your instructions.
I was able to run your code.
I have examined the HelloANE.cpp, interface function is written in C language.
My project had been described in the class of Objective-C.
For example,
------
#import <Foundation/Foundation.h>
#import <Adobe AIR/Adobe AIR.h>
@interface NativeLibForMac : NSObject
void aneExtInitializer(
void** extDataToSet,
FREContextInitializer*ctxInitializerToSet,
FREContextFinalizer* ctxFinalizerToSet);
void aneExtFinalizer(void* extData);
void aneContextInitializer(
void* extData,
const uint8_t* ctxType,
FREContext ctx,
uint32_t* numFunctionsToSet,
const FRENamedFunction** functionsToSet);
void aneContextFinalizer(FREContext ctx);
FREObject execNative(
FREContext ctx,
void* funcData,
uint32_t argc,
FREObject argv[]);
@end
-------
I wonder can no longer be run on Objective-C from AIR20?
Copy link to clipboard
Copied
Using Objective-C shouldn't be an issue I think. The reason why I sticked to standard C, is that I'm currently working on a cross-platform solution and I'll need a windows dll too.
Copy link to clipboard
Copied
Hi, Balazs,
I'm sorry. This is the content should be questions to the staff of Abobe.
At least, that was found to be able to run if the standard C has survived a lot.
Thank you.
Copy link to clipboard
Copied
Here is a working example I made
GitHub - tuarua/LibHelloWorldANE64-master: Hello World Adobe AIR 64bit ANE
It is a basic Hello World example. I've included an Xcode project written in C++ and Flash Builder projects for the ANE swc and a basic example of the ANE being used.
Please note, to use with Flash Builder AIR SDK 20 must be installed as the default AIR SDK as per these Adobe blogs:
Please see notes on AIR 64-bit on Mac OSX
How to install Air 3.9 SDK into FB 3.7‌
I've also included a shell script if you prefer to run the example with ADL instead of Flash Builder
I hope it is of some use to people.
Copy link to clipboard
Copied
I'm in the process of updating our existing ANEs to 64-bit for Mac OS X. They seem to still have problems (Error #3500) if you include a dependency dylib.
I've managed to reduce the ANE to a very simple test case that succeeds upon calling TestAne_Test_Func if I don't have the dependent library (or calls), and fails when the dylib is included. To test without the dylib, just define USE_DYLIB or make the dylib non-optional in the "Linked frameworks and Libraries" setting. Note: it will fail even if you non-optionally link the dylib but leave the calls to it disabled. It seems like AIR isn't finding the dynamic library included in the framework anymore. Looking in a release export, the dylibs aren't included in the release .app either.
This is a big problem for ANEs that use third-party libraries that are provided as dylibs.
Dylib sources:
TestAneDylibFunctions.hpp:
#ifndef TestAneDylibFunctions_hpp
#define TestAneDylibFunctions_hpp
#include <stdio.h>
class TestAneDylibFunctions
{
public:
TestAneDylibFunctions();
~TestAneDylibFunctions();
void TestFunction(const char * msg);
};
#endif /* TestAneDylibFunctions_hpp */
TestAneDylibFunctions.cpp:
#include "TestAneDylibFunctions.hpp"
TestAneDylibFunctions::TestAneDylibFunctions()
{
}
TestAneDylibFunctions::~TestAneDylibFunctions()
{
}
void TestAneDylibFunctions::TestFunction(const char * msg)
{
printf("Test function: %s", msg);
}
ANE native code:
TestAne.h:
#ifndef TESTANE_H_
#define TESTANE_H_
#include "FlashRuntimeExtensions.h"
extern "C" {
// Symbols tagged with EXPORT are externally visible.
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
#define EXPORT __declespec(dllexport)
#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__)
// Must use the -fvisibility=hidden gcc option.
#define EXPORT __attribute__((visibility("default")))
#else
#error "Platform not supported"
#endif
// Framework entry point
EXPORT void testAneInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet);
// Framework entry point
EXPORT void testAneFinalizer(void* extData);
}
#endif /* TESTANE_H_ */
TestAne.cpp:
#include "TestAne.h"
#include <vector>
#include <string>
#include "TestAneDylibFunctions.hpp"
static std::vector<FRENamedFunction> named_functions;
namespace AneHelperFuncs {
FREObject getFREUint32(uint32_t const value) {
FREObject returnValue;
FREResult const freResult = FRENewObjectFromUint32(value, &returnValue);
if (FRE_OK != freResult) {
fprintf(stderr, "FRENewObjectFromUint32 - failed to create return value");
return NULL;
}
return returnValue;
}
}
static void addFunction(char const * const name, void * data, FREFunction func) {
FRENamedFunction nf = { (uint8_t const * const ) name, data, func };
named_functions.push_back(nf);
}
////////////////////////////////////////////////////////////////////////////////////////
static uint32_t VERSION = 23;
extern "C" FREObject TestAne_Test_Func(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
puts("TestAne_Test_Func");
#if defined(USE_DYLIB)
TestAneDylibFunctions * funcs = new TestAneDylibFunctions();
funcs->TestFunction("abcd");
delete funcs;
#endif
return AneHelperFuncs::getFREUint32(VERSION);
}
////////////////////////////////////////////////////////////////////////////////////////
extern "C" void testaneContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctions, const FRENamedFunction** functions) {
puts("TestAne testaneContextInitializer");
addFunction("TestAne_Test_Func", NULL, &TestAne_Test_Func);
*numFunctions = (uint32_t)(named_functions.size());
*functions = &named_functions.at(0);
}
extern "C" void testaneContextFinalizer(FREContext ctx) {
puts("TestAne testaneContextFinalizer");
return;
}
extern "C" void testAneInitializer(void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer) {
puts("testAneInitializer");
*ctxInitializer = &testaneContextInitializer;
*ctxFinalizer = &testaneContextFinalizer;
}
extern "C" void testAneFinalizer(void* extData) {
puts("testAneFinalizer");
return;
}