How to use some types which have different names between Linux and Windows?

52 views
Skip to first unread message

Dāvis Mosāns

unread,
Nov 28, 2013, 2:35:09 PM11/28/13
to ruby...@googlegroups.com
For example, I need off64_t type which should be 64-bit for both x86, x86_64 and for Linux, Windows platforms

But this type have different names for each platform in https://github.com/ffi/ffi/tree/master/lib/ffi/platform
  • i386-linux - __off64_t
  • i386-windows - _off64_t
  • x86_64-linux - __off64_t
  • x86_64-windows _off64_t

Based on these names seems it's not possible to use them in my platform-independent Ruby code without making platform checks which seems silly.

If I use "attach_function :fn, [_off64_t], :void" it won't work in other platforms than Windows, becase there won't be defined such type.

So seems currently I've to use int64_t


Daniel Berger

unread,
Dec 1, 2013, 8:01:44 AM12/1/13
to ruby...@googlegroups.com
If it has a leading underscore like that, I don't think you're supposed to use it directly. Does int64_t work for you?

Regards,

Dan 

Dāvis Mosāns

unread,
Dec 4, 2013, 7:52:49 PM12/4/13
to ruby...@googlegroups.com
yeah, now I'm using int64_t which works fine, but it would be good if could use same types as in C headers, like off64_t which actually is defined for x86_64-windows but not anywhere else. So if I would use it, it would work only on that platform... I think this actually might be bug and I could submit PR so that there's same type for all platforms.
Reply all
Reply to author
Forward
0 new messages