Marmalade extension and library with c++11 code - c++11

I have a compiled static library for iOS, which uses c++11 functions internally. Can I use this library in extension for Marmalade 8.3 (without c++11 support)? Extension compiles ok on Mac, but when I try to build my app with this extension on PC, I have an error during deploy:
Undefined symbols for architecture armv7:
__ZNSt3__119__shared_weak_countD2Ev, referenced from:
...

C++ 11 runtime is very different from Cx99 runtime.
Marmalade 8.4 officialy supports C++ 11.
Try to recompile both the extension and the app with C++ 11 support enabled.

Related

Loading OpenSSL dynamic libraries arm & x86 (FMX, C++)

I am able to use OpenSSL static libraries (libcrypto.a and libssl.a) in my iOS app thanks to this help. Now i can also use OpenSSL dynamic libraries (libcrypto.so and libssl.so) in my Android app version thanks to this info. I downloaded the files for Android in the OpenSSL_1.0.2g_Android.zip file from here. I just guessed and used the ARM files (armeabi-v7a folder) instead of the Intel files (x86 folder) and it worked on my Android test phone.
My question: How do I make an Android build that uses the correct library files on ARM devices AND also on Intel? I don't know how to deploy both sets of files for this. Below is snip of project window showing where i test added the second libcrytpo.so library file for x86.
But, this second libcrypto.so does not show up in the deployment window, only the first version i added (the ARM version) remains.
I was hoping i could somehow use compiler directives but maybe i just need 2 independent projects altogether? One built for Android ARM and other for Android x86? Further, all i'm needing in my code is an IdHTTP1->Get() so maybe their is a way i can use the built in BoringSSL fork? If so, how?
russ
C++Builder 10.3 Version 26.0.33219.4899
RAD Studio does not support producing Android apps for Intel, only for ARM, so don't even worry about trying to use the x86 libs on Android.
Also, Indy does not support BoringSSL at this time.

Xamarin iOS simulator build

Does anyone know if Xamarin build for iOS simulator is somehow different from regular Xcode simulator build?
In other words is Xamarin simulator build "clean" native build?
As stated in Xamarin docs:
When you compile any Xamarin platform application, the Mono C# (or F#)
compiler will run and will compile your C# and F# code into Microsoft
Intermediate Language (MSIL). If you are running a Xamarin.Android, a
Xamarin.Mac application, or even a Xamarin.iOS application on the
simulator, the .NET Common Language Runtime (CLR) compiles the MSIL
using a Just in Time (JIT) compiler. At runtime this is compiled into
a native code, which can run on the correct architecture for your
application.
However, there is a security restriction on iOS, set by Apple, which
disallows the execution of dynamically generated code on a device. To
ensure that we adhere to these safety protocols, Xamarin.iOS instead
uses an Ahead of Time (AOT) compiler to compile the managed code. This
produces a native iOS binary, optionally optimized with LLVM for
devices, that can be deployed on Appleā€™s ARM-based processor.

How do I structure my Xamarin app to ensure crossplatform functionality?

Hey I'm a Xamarin beginner who is a bit confused on how to structure my app to ensure cross-platform functionality while writing the smallest amount of code necessary. I have a library written in C and when using this library previously I would go the NDK route(for android), I now have to use the library for my Xamarin.Android and Xamarin.ios app. I want to know what the best way of achieving this goal is. Do I create a shared library or a PCL? Do I find a way to compile the library into a dll and just include in the Xamarin project?
Linking to C "native" libraries does not really change because you are using Xamarin, you still need to build all the various ARCH types, create universal/fat libs, etc...
On iOS you would be linking to a static lib or loading a .dylib:
iOS Linking/Interop Native Libraries
On Android you would be using your .so just like NDK (Xamarin.Android produces an NDK-based app):
Using Native Libraries on Android
*Note: If you are using Visual Studio, you also can debug your 'native' C/C++ along side your Xamarin.Android C# project.
In your C# code, in order to access methods defined in either one of those, you use Mono's P/Invoke functionality which is the same technology that you would use in .NET to access functions in C-based libraries.
Accessing C Methods from C#

Visual Studio xamarin forms iOS entrypointnotfound with simulator but not iphone

In my Visual Studio Xamarin Forms iOS project, I am linking against a native (c++) library I built and deployed using Visual Studio Cross C++ Platform. I can link and run against an actual device (through the Mac Server), but I cannot get it to work through the simulator. If I build with the same link settings, the build fails, not being able to find the entrypoint. If I choose not to link, then the build succeeds but I get am Entrypointnotfoundexception when running at the point where I try to call into the native code.
I just went through the example from your comment, using his sample code here. I had to do a couple things to get it to run correctly. My problem was on Xamarin.iOS, but the same steps can be applied for Xamarin.Forms, assuming you already have platform-specific integration working.
Since you have the code working on a physical device, you should already have a Native Static Reference to your .a library. But the iOS simulator runs on the x86_64 architecture (iOS 11 and later does not support i386), while your device likely runs on some version/variant of ARM. It sounds like your library is built to support only your device's architecture. You can check this by running lipo from your Mac:
% lipo -info /usr/lib/libCLib.iOS.a
To support the sim's architecture as well (see this article), build the C++ project to the architectures you need to support, then combine them, like so:
lipo -create -output libCLib.iOS.a libCLib.iOS-x8664.a libCLib.iOS-arm64.a
Use that output .a file as your new Native Static Reference file back in Visual Studio. Change Supported Architectures in your project settings to x86_64, and that should be everything. Hope this helps somebody.

SDL error in Xcode

I was trying to use SDL framework for jpg loading of opengl texture, but when i try to build i got this message:
ld: warning: in /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks//SDL.framework/SDL, missing required architecture ppc in file
What can i do to made SDL work in i386?
Have to download the source code and then make the file, or there is one already for i386?
The warning message says the version of the SDL framework on your machine is Intel-only, but you are building a universal (Intel and PowerPC) SDL application. The main Mac version of SDL 1.2.15 dropped PowerPC support. The simplest solution is to go to the SDL site and download the version of the SDL libraries that has support for PowerPC and Mac OS X 10.4.
Another solution is to modify the Architectures build setting in your project and tell Xcode to build for Intel only.

Resources