xamcat/mobcat-samples

cpp_with_xamarin

Opened this issue · 4 comments

cpp_with_xamarin is bad

using System;

namespace MathFuncs
{
internal class MyMathFuncs : IDisposable
{
private readonly MyMathFuncsSafeHandle handle;

    public MyMathFuncs()
    {
        handle = MyMathFuncsWrapper.CreateMyMathFuncs();
    }

    protected virtual void Dispose(bool disposing)
    {
        if (handle != null && !handle.IsInvalid)
        {
            handle.Dispose();
        }
    }

    public void Dispose()
    {
        Dispose(disposing: true);
        GC.SuppressFinalize(this);
    }

    public double Add(double a, double b)
    {
        return MyMathFuncsWrapper.Add(handle, a, b);
    }

    public double Subtract(double a, double b)
    {
        return MyMathFuncsWrapper.Subtract(handle, a, b);
    }

    public double Multiply(double a, double b)
    {
        return MyMathFuncsWrapper.Multiply(handle, a, b);
    }

    public double Divide(double a, double b)
    {
        return MyMathFuncsWrapper.Divide(handle, a, b);
    }
}

}
#if false // 反编译日志
缓存中的 117 项

解析: "netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
找到单个程序集: "netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
从以下位置加载: "C:\Users\kkkkkkk.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\netstandard.dll"
#endif

using System.Diagnostics;
using MathFuncs;
using Xamarin.Forms;

namespace MathFuncsApp
{
public partial class MainPage : ContentPage
{
MyMathFuncs myMathFuncs;

MyMathFuncs could not access ,because internal not public

where netstandard2.0 dll from c++???

I'm getting the [mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libMathFuncs.so every time. I tried switching out parts of my implementation for the prebuilt components (the native libraries and NuGet packages found within the Artefacts folder) but had no luck.
Can anyone pls help? @mikeparker104