[Gtk-sharp-list] Use mono to access shared memory?

Jonathan Pryor jonpryor@vt.edu
Tue, 29 Mar 2005 20:44:48 -0500


On Tue, 2005-03-29 at 13:34 -0500, Wei Weng wrote:
> I am not sure if this is the right mailing list to ask, please let me know 
> if you feel the topic is inproperly posted.

mono-list would be more appropriate.

> (How) can I use mono to access shared memories? (It is created with System V 
> IPC calls) Any examples I can look at?

You'd have to P/Invoke the methods manually:

	[DllImport ("libc")]
	public static extern int shmget (int key, UIntPtr size, int shmflag);

The downside is that it's not quite this easy, since `key' is supposed
to be a `key_t' (which happens to be an int on x86 Linux), and `size' is
a `size_t', which is (1) typically an unsigned long, and (2) 32-bits on
32-bit platforms, 64-bits on 64-bit platforms (hence a UIntPtr).  It may
require platform-specific glue code to be fully portable; see
MonoPosixHelper (in mono/support) for an example.

 - Jon