Last active
August 5, 2023 20:00
-
-
Save lothrop/3a12cc32051c623c7085 to your computer and use it in GitHub Desktop.
Using C libraries in Xamarin projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "CLib.h" | |
int32_t clib_add_internal(int32_t left, int32_t right) | |
{ | |
return left + right; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <stdint.h> | |
int32_t clib_add_internal(int32_t left, int32_t right); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include "CLib.h" | |
int32_t clib_add(int32_t left, int32_t right) | |
{ | |
return clib_add_internal(left, right); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("libCLib", EntryPoint = "clib_add")] | |
private static extern int Add(int left, int right); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("__Internal", EntryPoint = "clib_add")] | |
pivate static extern int Add(int left, int right); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<AndroidNativeLibrary Include="libCLib.so"> | |
<Abi>armeabi-v7a</Abi> | |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
</AndroidNativeLibrary> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment