chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Trouble with FFI and 64 bit machines


From: Stephen Eilert
Subject: [Chicken-users] Trouble with FFI and 64 bit machines
Date: Fri, 8 Oct 2010 15:39:46 -0300

Hi guys,

As some of you might be aware, I am creating bindings for the Discount
(http://www.pell.portland.or.us/~orc/Code/discount/) library. However,
I have run into a problem.

When testing on my OSX (Snow Leopard) machine with a 64 bit chicken, I
get a segfault. After some debugging (and Ventonegro's help), I've
narrowed it down to the following definition:

(define mkd_in
  (foreign-lambda c-pointer mkd_in c-pointer int))

  The function being bound is "MMIOT* mkd_in(FILE *f, int flags)"
(where MMIOT is defined as void by the header file), which returns a
pointer that is fed to the 'markdown' function for processing and
blows up the first time it is dereferenced.


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.

The full code is in github: git://github.com/spedrosa/Discount.git
(requires libmarkdown)

I'll do more OSX tests later today, but assistance would be helpful :)


--Stephen

Sent from my Emacs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]