11

次の C++ コードがあるとします。

extern "C" {
    void testA(int a, float b) {
    }

    static void testB(int a, float b){
    }
}

次を使用して、C#プロジェクトでこれにアクセスしたいDllImport:

class PlatformInvokeTest
{
    [DllImport("test.so")]
    public static extern void testA(int a, float b);
    [DllImport("test.so")]
    internal static extern void testB(int a, float b);

    public static void Main() 
    {
        testA(0, 1.0f);
        testB(0, 1.0f);
    }
}

これは に対しては問題なく動作testAtestBますが、EntryPointNotFoundException のスローに失敗します。

testBC# コードからアクセスできますか? どのように?

4

1 に答える 1