hai! I find the way tho call the 3rd party lib ".so" in the monodroid, like
that:

//the file name is sum.c
#include <stdio.h>
int sum(int a, int b)
{
        return a + b;
} 

------------------------------
using System;
using System.Runtime.InteropServices;
public class UnsafeDemo
{
        [DllImport ("libsum.so", EntryPoint="sum")]  // sum is the native
function name
         static extern int sum(int a, int b);

        unsafe static void Main()
        {
                int x = sum(23, 45);
                Console.WriteLine("x: {0}", x);
        }
}
----------------------------------------------------------------

and you must edit your project file to explicitly specify the ABI to use:
<ItemGroup>  
    <AndroidNativeLibrary Include="path/to/libsum.so">  
        <Abi>armeabi</Abi>  
    </AndroidNativeLibrary>  
</ItemGroup>  

then it will running............

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/3rd-party-lib-tp4441589p4560247.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to