I have C++ shared library which export method int MyFunc()
for both Linux and Windows.
From C# I do call the MyFunc
with following signature.
[DllImport(@"__Internal", CharSet = CharSet.Ansi, EntryPoint = "MyFunc")]
static extern unsafe int MyFunc();
// Later I'm using :
MyFunc();
This code works fine on windows but inside linux this throw an exception EntryPointNotFound
.
I have compiled my C++ library with -rdynamic option and I can see MyFunc is exported as D flag with nm but this also didn't help me.
Without any change if I simply change DllImport(@"__Internal"
to DllImport(@"mys.so"
then will work fine on linux but then I have to use DllImport(@"mys.dll"
in windows which this breaks code cross compatible feature.
So I want to avoid this.
I don't see any mistake that why __Internal
isn't working on Linux.
Note that I'm using mono.
Any idea why this is not working on Linux ?