Xamarin import of .so file successful but can't find the file's contents

354 Views Asked by At

Output window prompts:

06-17 17:01:32.600 D/Mono    (14927): Searching for 'getcpufamily'.
06-17 17:01:32.600 D/Mono    (14927): Probing 'getcpufamily'.
06-17 17:01:32.600 D/Mono    (14927): Could not find 'getcpufamily' due to 'Could not find symbol 'getcpufamily'.'.
and :   06-17 17:01:32.776 W/Trace   (14927): Unexpected value from nativeGetEnabledTags: 0

my code is:

[DllImport("libcheckcpu.so")]
public static  extern int getcpufamily();
1

There are 1 best solutions below

0
On

Is it of correct architecture? Did you define ABI for the .so file? Is it marked as AndroidNativeLibrary?

<ItemGroup>
    <AndroidNativeLibrary Include="path/to/libfoo.so">
        <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
</ItemGroup>

Just in case here is the documentation: http://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/ http://www.mono-project.com/docs/advanced/pinvoke/ Pretty sure you've seen it though.