简体   繁体   English

跨平台移动C ++ SDK通常如何工作?

[英]How do cross platform mobile C++ SDKs generally work under the hood?

I found a related answer here: How do cross-platform mobile app development frameworks work? 我在这里找到了一个相关的答案: 跨平台移动应用程序开发框架如何工作?

but I was thinking more about c++ cross-platform SDKs work (eg Corona, Marmalade, EdgeLib, etc.). 但我正在考虑更多关于c ++跨平台SDK的工作(例如Corona,Marmalade,EdgeLib等)。 They provide the ability to export binaries for iOS and Android while allowing the developer to use C++ code. 它们提供了导出iOS和Android二进制文件的功能,同时允许开发人员使用C ++代码。 My assumption is listed below, but please correct it if I am wrong anywhere: 我的假设如下所示,但如果我在任何地方错了,请更正它:

  1. User writes code in C++. 用户使用C ++编写代码。
  2. SDK has an interface layer with C++ functions called in user code requesting mobile OS specific functionality. SDK具有一个接口层,其中包含用户代码中调用的C ++函数,请求移动操作系统特定的功 This interface layer is built from code required to implement that SDK function call in the specific mobile OS(written in Java for Android and Obj-C for iOS). 此接口层是根据在特定移动操作系统中实现SDK函数调用所需的代码构建的(用Java编写,适用于Android和Obj-C for iOS)。
  3. Part I am most confused about because I don't have much mobile dev experience points: Do iOS and Android both have C++ cross compilers that can compile the general logic code written in C++ in the user's app? 第一部分我最困惑的是因为我没有太多的移动开发经验点:iOS和Android都有C ++交叉编译器,可以在用户的​​应用程序中编译用C ++编写的通用逻辑代码吗?

MoSync is an example of a C++ based cross platform mobile toolkit - this one starts by using the open source GCC compiler to compile your app's C++ code into an assembly-like format. MoSync是基于C ++的跨平台移动工具包的一个示例 - 这个工具包首先使用开源GCC编译器将应用程序的C ++代码编译成类似于程序集的格式。 A custom tool by MoSync (called the 'PipeTool') then combines this assembly format with their pre-compiled libraries into various target formats, including java bytecode (for Android) or Objective-C source (for iOS). MoSync的一个自定义工具(称为“PipeTool”)然后将这个汇编格式与其预编译的库组合成各种目标格式,包括java字节码(用于Android)或Objective-C源(用于iOS)。 More detail about this process here . 这里有关于此过程的更多细节。

The final compilation on the target platform (Android or iOS) is left to you, using the native IDE (Xcode for iOS and Eclipse IDE with Android SDK for Android). 目标平台(Android或iOS)上的最终编译由您自己决定,使用原生IDE(适用于iOS的Xcode和适用于Android的Android SDK的Eclipse IDE)。 So to create an iOS application you'll still need to be a member of the Apple iOS developer program (US$99 per year) for example, whereas the Eclipse IDE and Android SDK are free. 因此,要创建iOS应用程序,您仍然需要成为Apple iOS开发人员计划的成员(例如每年99美元),而Eclipse IDE和Android SDK是免费的。

Your example of Corona SDK is not fully relevant since Corona builds into the native binary format using their custom build servers in the cloud - what goes on there is not fully documented as its a closed source toolkit. 您的Corona SDK示例并不完全相关,因为Corona使用云中的自定义构建服务器构建为本机二进制格式 - 其中没有完全记录为其封闭源工具包。 You pay a subscription fee per year to Corona to be able to build apps. 您每年向Corona支付订阅费,以便能够构建应用程序。 I'm not sure about the other ones you mentioned (Marmalade, EdgeLib, etc.) but would assume they are similar to MoSync. 我不确定你提到的其他(Marmalade,EdgeLib等),但会认为它们与MoSync类似。

Check out codenameone.com - they use Java but eventually compile into C++ for iOS and Java for Android. 查看codenameone.com - 他们使用Java但最终编译成适用于iOS的C ++和适用于Android的Java。

The difference is their environment includes all the graphics and they create the controls themselves so you get an actual native application with just one codebase. 区别在于他们的环境包括所有图形,并且他们自己创建控件,因此只需一个代码库就可以获得实际的本机应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM