
I'm starting the Mono POSIX shared memory wrapping, decided to begin dllimporting shm_open, however doesn't seems to be easy at all, my current effort is:
namespace Mono.Posix { [DllImport ("librt", EntryPoint="shm_open", CharSet=CharSet.Ansi, public static void Main (string []args)using System;
using System.Runtime.InteropServices;
public class SharedMemory
{
public SharedMemory ()
{ }
CallingConvention=CallingConvention.StdCall)]
public static extern IntPtr Open (
[MarshalAs (UnmanagedType.LPStr)] string name,
int oflag,
int mode_t);
{
//O_RDONLY = 00
//O_WRONLY = 01
//O_RDWR = 02
SharedMemory m = new SharedMemory ();
SharedMemory.Open ("test", 0, 777);
}
}
}
After compiling and running, I get:
Unhandled Exception: System.ExecutionEngineException: SIGILLSharedMemory.cs(22,17): warning CS0219: The variable `m' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
at [0x00000] unknown method
at (wrapper managed-to-native) Mono.Posix.SharedMemory:Open (string,int,int)
at Mono.Posix.SharedMemory.Main (System.String[] args) [0x00000]
Ignore the warning and notice the SIGILL related exception, may it be something about current marshaling? Will again, but later, I need to rest, tomorrow will wake up earlier.