Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp_with_xamarin #64

Open
tianlv777 opened this issue Dec 30, 2022 · 4 comments
Open

cpp_with_xamarin #64

tianlv777 opened this issue Dec 30, 2022 · 4 comments

Comments

@tianlv777
Copy link

cpp_with_xamarin is bad

@tianlv777
Copy link
Author

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

@tianlv777
Copy link
Author

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

@tianlv777
Copy link
Author

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

@rubverma
Copy link

rubverma commented Feb 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants