C Native API on iOS and Android ?!

Hello,
I have a question about implementing native C API with Corona enterprise that work on both android and iOS. Is it possible? If the answer is yes, where (project folder/file structure) can i put my C code? and how to call them?

** I know about how to implement/use objective C native code for iOS and Java for Android platfrom.

Thanks.

Yes, you can definitely write in C or C++. Whether this works on both Android and iOS of course depends on the library, but that’s not typically a language issue.

You could really put the code wherever, so long as you put the output files (library or framework from iOS or shared object for Android) in the right place. In the end this depends on whether you’re trying to build your entire program through Enterprise or making a plugin; for the former case, and to get started generally, you can follow the App template included in Enterprise. See also memoryBitmap or various entries in this list for examples of C or C++ plugin code.

For Android you’ll also want the NDK.

Looking at this project:   https://github.com/coronalabs/plugins-sample-memoryBitmap

There is a “Shared” folder, since C code would be useable across platforms. In Xcode you still have to include them in the project. The folder is kinda of irrelevant since Xcode just has pointers to files. But “Shared” makes organizational sense. 

Rob

Thank you Rob and StarCrunch.

Yes, you can definitely write in C or C++. Whether this works on both Android and iOS of course depends on the library, but that’s not typically a language issue.

You could really put the code wherever, so long as you put the output files (library or framework from iOS or shared object for Android) in the right place. In the end this depends on whether you’re trying to build your entire program through Enterprise or making a plugin; for the former case, and to get started generally, you can follow the App template included in Enterprise. See also memoryBitmap or various entries in this list for examples of C or C++ plugin code.

For Android you’ll also want the NDK.

Looking at this project:   https://github.com/coronalabs/plugins-sample-memoryBitmap

There is a “Shared” folder, since C code would be useable across platforms. In Xcode you still have to include them in the project. The folder is kinda of irrelevant since Xcode just has pointers to files. But “Shared” makes organizational sense. 

Rob

Thank you Rob and StarCrunch.