This is the first time I'm trying to create a C ++ library for Android / iOS.
I am using Visual Studio 2015 - Xamarin.
First I created a project: Visual C ++ -> Cross Platform -> Shared Library. In the guest library I created 2 files.
SayHello.h:
#pragma once #include <string.h> class SayHello { public: SayHello(); ~SayHello(); static char* Hello(); };
SayHello.cpp:
#include "SayHello.h" extern "C" { SayHello::SayHello(){} SayHello::~SayHello(){} char * SayHello::Hello() { return "Hello !"; } }
Then I generated the libSayHello.so file and created an Android project with xamarin to try to call the hello function. There is my MainActivity.cs:
[DllImport("libSayHello.so")] static extern String Hello(); protected override void OnCreate(Bundle bundle) {
I have done all the steps in this tutorial , but I have an exception:
System.DllNotFoundException: libSayHello.so
I was looking for this, but I have to be so noob because I did not find anything. How to use my libSayHello.so ?
EDIT:
There is my libSayHello.so with 7zip:

And my project:

source share