[Mono-dev] Fixing KeventWatcher: dealing with 32 / 64 bit operating systems
Romain Tartière
romain at blogreen.org
Sat Sep 19 06:38:09 EDT 2009
On Sat, Sep 19, 2009 at 11:46:06AM +0200, Robert Jordan wrote:
> For *BSD, timespec is declared like this in native code:
>
> struct timespec {
> time_t tv_sec; /* seconds */
> long tv_nsec; /* and nanoseconds */
> };
>
> while "time_t" is an "int32_t" on 32-bit and "int64_t" on 64-bit.
> Long is "int32_t" on 32-bit and "int64_t" on 64-bit, so we can
> use IntPtr in the C# p/invoke declaration:
>
> struct timespec {
> public IntPtr tv_sec;
> public IntPtr tv_usec;
> }
Yes, I am examinating this. I am just unsure about how ugly /
acceptable it is to:
- Replace "ev.data = 0" with "ev.data = IntPtr.Zero";
- Replace "ev.ident = fd" with "ev.ident = (IntPtr)fd".
Another related point, the requests Hashtable keys are (depending of the
instruction that use them) use with int (4 bytes, plateform agnostic) or
long. Is it okay to "requests [(IntPtr)fd] = data" ?
Thanks!
Romain
--
Romain Tartière <romain at blogreen.org> http://romain.blogreen.org/
pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43)
(plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090919/07467027/attachment.bin
More information about the Mono-devel-list
mailing list