Giter Club home page Giter Club logo

mobcat's People

Contributors

alexblount avatar alexeystrakh avatar alexkblount avatar benbtg avatar deanfaizal avatar lobrien avatar mikeparker104 avatar sweekriti91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobcat's Issues

Suggestion cpp_with_xamarin

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.

Settings for native debugging?

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

How to call a C (not C++) library from Xamarin?

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?

[question] Stuck the last step of cpp_with_xamarin

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:

  1. 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

  2. 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?

  3. Add the create nuget package to the consuming Xamarin Forms project, compile and run

  4. 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:

  • I have verified that the simulators are using compatible processors (x84_64 for the android project and an iPhone 8 with 64 bit arm)
  • I have made sure that the nuget package being used was actually the one create in step 2 above.

Any help would be appreciate to nudge me in the right direction.

Android: error '...relocation R_386_GOTOFF...' while compiling native

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

using MathFuncs [Error CS0246] [cpp_with_xamarin]

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)

How to support Mac OS

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.