[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Trouble with FFI and 64 bit machines
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] Trouble with FFI and 64 bit machines |
Date: |
Fri, 8 Oct 2010 20:58:28 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Oct 08, 2010 at 03:39:46PM -0300, Stephen Eilert wrote:
> I get the following compilation warning, which is likely the source of
> the corrupt pointer:
>
> csc -c testcase.scm
> testcase.c: In function 'stub3':
> testcase.c:31: warning: cast to pointer from integer of different size
>
> Even though I get the same warnings under Ubuntu 64, it runs fine.
>
> To reproduce the warning:
>
> Just create a file containing the above foreign-lambda and compile it
> with csc -c.
I'm not sure if that's the problem with your egg, but this results in a
compiler warning because there's no prototype for that function, so
C assumes the return value's type is 'int', which is indeed a different
size than void * on x86_64.
Adding (foreign-declare "void *mkd_in(void *, int);") in front of that
code causes it to compile without warnings.
Perhaps you should figure out whether the header file is being included
properly. Maybe you can temporarily put a "#error hi" just before the
function's prototype in the header file, so you can see if it's not
skipping the prototype due to a #ifdef or something equally silly.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth