xamarin / mobcat Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello,
I used your cpp_with_xamarin example but noticed the distinct lack of example for UWP.
For my own project i have made a WinRT C++ component and included the necessary project and updated the .nuspec to mirror this. I thought my repository might be of help to others who seek this information, or give inspiration to update your example to include UWP.
You can refer to this issue i opened on the article itself.
.
Hello,
first of all thanks for your great tutorial
I have a native library to compile for Android and iOS.
In iOS I dont have problems, but for Android I have that when I call this line:
$CXX -shared -static-libstdc++ -o ${PWD}/sourceFilesAndroid/lib${LibraryName}.so ${PWD}/sourceFilesAndroid/*.o
the script return me this error:
/Users/user/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: /Progetti/_InimSDK/PrimeAPIMobile/PrimeFuncsLib/tmp/sourceFilesAndroid/seriale.o: relocation R_386_GOTOFF against preemptible symbol app_data cannot be used when making a shared object
Here I read that it shoud be a problem on the latest ndk
Anyway I add -fPIC for cpp compiling and now the so files are generated
for i2 in $LibPath/*.cpp; do
ShortName="${i2##*/}"
OutputName="${ShortName/cpp/o}"
$CXX -c $i2 -std=c++0x -fPIC -D __MYblabla__ -o ${PWD}/sourceFilesAndroid/$OutputName
done
$CXX -shared -static-libstdc++ -o ${PWD}/sourceFilesAndroid/lib${LibraryName}.so ${PWD}/sourceFilesAndroid/*.o
Hope it can helps other users
Thanks
The sample of share code target platform is Android and iOS, how to support Mac at the same time, can you give me a sample?
I have a library(already compiled to .a, .dylib, .dll) and I want to share code in all platform(Android,IOS,Mac,Windows)
Hello there!
I followed the instructions step by step, but Xamarin project could not see the namespace MathFuncs that you made on files .so and .a, as well.
Because of that I can not use "using MathFuncs" and I get always that error.
Could you help me, please?
/Users/.../Projects/MathFuncsApp/MathFuncsApp/MainPage.xaml.cs(3,3): Error CS0246: The type or namespace name 'MyMathFuncs' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (MathFuncsApp)
Hi,
I'm wondering how to call a pure C library from Xamarin?
For C++, I might get a safe handle during construction and release it in Dispose() method as your examples show.
For pure C, however, do I still need to get a safe handle and release it in the end?
I want to create custom alert with design and icons custom to my app. How can I do that?
First off thanks for the tutorial it really did got a long way demystifying the different steps involved to use C++ in Xamarin. Unfortunately I am stuck with one runtime error with the Android build and another with the iOS build. I am working with VS for Mac. Steps to get to my current state were:
Cloned this repo, and corrected two issues that were causing errors.
Xamarin Forms project - the iOS project referenced images in the csproj file that did not exist in the asset catalog
MathFuncs project - The Android project had a missing .so files in the x84 lib folder
Compiled the MathFuncs dlls and added them to the nuget package. I just added them in with the nuget CLI tool, I could not verify that the nuget package actually had those dlls within it. Is there a nuget explorer for Mac like there is for windows? or could I just that same tool to verify a package made with VS for Mac?
Add the create nuget package to the consuming Xamarin Forms project, compile and run
I get the following errors:
iOS at runtime
System.EntryPointNotFoundException: CreateMyMathFuncsClass
at at (wrapper managed-to-native) MathFuncs.MyMathFuncsWrapper.CreateMyMathFuncs()
at MathFuncs.MyMathFuncs..ctor () [0x00006] in /Users/hhaider/Projects/mobcat/samples/cpp_with_xamarin/Sample/Wrapper/MathFuncs/MathFuncs.Shared/MyMathFuncs.cs:11
at MathFuncsApp.MainPage.OnAppearing () [0x00008] in /Users/hhaider/Projects/mobcat/samples/cpp_with_xamarin/Sample/Consumer/MathFuncsApp/MathFuncsApp/MainPage.xaml.cs:19
at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:316
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidAppear (System.Boolean animated) [0x00025] in <55e20ffeeae44e4d8fcf262393127192>:0
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.3.1.28/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.3.1.28/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at MathFuncsApp.iOS.Application.Main (System.String[] args) [0x00001] in /Users/hhaider/Projects/mobcat/samples/cpp_with_xamarin/Sample/Consumer/MathFuncsApp/MathFuncsApp.iOS/Main.cs:12
Android at runtime
System.DllNotFoundException: libMathFuncs.so
at at (wrapper managed-to-native) MathFuncs.MyMathFuncsWrapper.CreateMyMathFuncs()
at MathFuncs.MyMathFuncs..ctor () [0x00006] in /Users/hhaider/Projects/mobcat/samples/cpp_with_xamarin/Sample/Wrapper/MathFuncs/MathFuncs.Shared/MyMathFuncs.cs:11
at MathFuncsApp.MainPage.OnAppearing () [0x00008] in /Users/hhaider/Projects/mobcat/samples/cpp_with_xamarin/Sample/Consumer/MathFuncsApp/MathFuncsApp/MainPage.xaml.cs:19
at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:316
at Xamarin.Forms.Platform.Android.PageRenderer.OnAttachedToWindow () [0x00027] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\PageRenderer.cs:42
at Android.Views.View.n_OnAttachedToWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <44fafc2e0f1847ee827456a85a04372d>:0
at at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.25(intptr,intptr)
Log of the console output for Android
[Mono] DllImport attempting to load: 'libMathFuncs.so'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so': 'dlopen failed: library "/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so': 'dlopen failed: library "/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/system/lib/libMathFuncs.so': 'dlopen failed: library "/system/lib/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/system/lib/libMathFuncs.so': 'dlopen failed: library "/system/lib/libMathFuncs.so" not found'.
[Mono] DllImport error loading library 'libMathFuncs.so': 'dlopen failed: library "libc++_shared.so" not found'.
[chatty] uid=10061(com.mobcat.MathFuncsApp) identical 1 line
[Mono] DllImport error loading library 'libMathFuncs.so': 'dlopen failed: library "libc++_shared.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "libc++_shared.so" not found'.
[Mono] DllImport attempting to load: 'libMathFuncs.so'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so': 'dlopen failed: library "/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so': 'dlopen failed: library "/storage/emulated/0/Android/data/com.mobcat.MathFuncsApp/files/.__override__/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/system/lib/libMathFuncs.so': 'dlopen failed: library "/system/lib/libMathFuncs.so" not found'.
[Mono] DllImport error loading library '/system/lib/libMathFuncs.so': 'dlopen failed: library "/system/lib/libMathFuncs.so" not found'.
[Mono] DllImport error loading library 'libMathFuncs.so': 'dlopen failed: library "libc++_shared.so" not found'.
[chatty] uid=10061(com.mobcat.MathFuncsApp) identical 1 line
[Mono] DllImport error loading library 'libMathFuncs.so': 'dlopen failed: library "libc++_shared.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "libc++_shared.so" not found'.
Things I have checked:
Any help would be appreciate to nudge me in the right direction.
This repository has had no activity in more than [x amount of time]. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.
Please see https://aka.ms/sunsetting-faq to learn more about this process.
✍️
❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒
If you take no action, this repository is still inactive 30 days from today it will be automatically archived..
1.) Consider providing a nuget option for everthing in Mobcat Shared.
e.g.) Xamarin.Mobcat
, Xamarin.Mobcat.Forms
2.) Consider using something like AsciiDocs to link code from Samples and Mobcat Shared dynamically into the directory/documentation.
Hello everyone,
I have managed to reproduce all the steps from this tutorial first on a MAC and afterwards from scratch on a Windows PC with Visual Studio 2017 alone. However, I can neither debug the native C++ code (from within Visual Studio 2017 on the windows PC) for Android nor for iOS. Can someone shed some light on what debug settings are required for the native libraries and for the managed wrapper assemblies, in order for the debug info to be present when debugging the final app? Is it possible at all? At least the Android project seems to provide the possibility to switch between managed debugging and C++ debugging, but my breakpoints are never hit. I do wonder if the debugging information gets lost, once the native code is wrapped inside the nuget package or maybe when running lipo for the iOS libraries, can someone with more experience verify or falsify this? I have even managed to omit the nuget step and directly use the managed wrappers with a second version of the final app which doesn't use the nuget package created from the wrapper assemblies, but still native debugging from Visual Studio 2017 on Windows doesn't work for me. Can someone shed some light on the different debugging settings for the different platforms that are required for native debugging?
Thanks,
--
Stefan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.