[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] long pointer equivalent
From: |
Peter Keller |
Subject: |
Re: [Chicken-users] long pointer equivalent |
Date: |
Mon, 26 Aug 2002 11:31:10 -0500 |
User-agent: |
Mutt/1.2i |
On Mon, Aug 26, 2002 at 09:28:47AM -0400, Perry E. Metzger wrote:
>
> "felix" <address@hidden> writes:
> > So would it be ok to have a foreign type specifier `int64' and
> > `unsigned-int64' that is handled on the Scheme side as a float? Like:
> >
> > (define lseek
> > (foreign-lambda unsigned-int64 "lseek" unsigned-int64 int) )
Aside from the floating point issue which Perry brought up, I'm still
leery of defining things like this because the point of the off_t(and
other posix *_t) types is so that these function calls are portable
across unicies.
How I'd do it:
;; should be supplied by chicken and it is determined during build time of
;; chicken itself
(define-foreign-type off_t unsigned-long)
;; this is closer to how I think it should be done.
(define lseek
(foreign-lambda off_t "lseek" int off_t int) )
See, the trouble is with a specific 64 bit type is how do you deal with
machines that happen to define that library call where an off_t is a
32-bit type? long on an ia64 is 8 bytes, but on an ia386 is 4 bytes,
therefore you may not use an unsigned-int64 as the interface call to
lseek because it isn't right all of the time.
Digging around in header files figuring out what these typedefs are for each
specific machine you want your code to work on is not cool. Unfortunately,
this comes around the the typedef problem again.
-pete
- Re: [Chicken-users] long pointer equivalent, (continued)
- Re: [Chicken-users] long pointer equivalent, Peter Keller, 2002/08/23
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/24
- Re: [Chicken-users] long pointer equivalent, Peter Keller, 2002/08/25
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/25
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/25
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/27
- Re: [Chicken-users] long pointer equivalent,
Peter Keller <=
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, Peter Keller, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, Benedikt Rosenau, 2002/08/26
- Re: [Chicken-users] long pointer equivalent, tonyg, 2002/08/27
- Re: [Chicken-users] long pointer equivalent, felix, 2002/08/27
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/27
- Re: [Chicken-users] long pointer equivalent, Peter Keller, 2002/08/27
- Re: [Chicken-users] long pointer equivalent, Perry E. Metzger, 2002/08/27
Re: [Chicken-users] long pointer equivalent, Benedikt Rosenau, 2002/08/17