[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Segfaults with shared library, foreign code
From: |
Evan Hanson |
Subject: |
[Chicken-users] Segfaults with shared library, foreign code |
Date: |
Mon, 28 Feb 2011 13:59:05 -0600 |
I'm trying to write bindings to the Clutter UI toolkit, but I'm
hitting segfaults when building a shared library. I've essentialized
the issue to the following code:
http://gist.github.com/847871#file_clutter.scm
The C is more or less copied & pasted from the Clutter docs, and it
compiles correctly both alone with gcc and in the above file with:
$ csc clutter.scm -C "`pkg-config --cflags clutter-1.0`" -L
"`pkg-config --libs clutter-1.0`"
$ ./clutter
[window opens, everything's good]
But when I remove the invocation of (main) or wrap it in a module and
try to build it as a shared library (with -s) it compiles fine but
segfaults when loaded at an interpreter or in another .scm file:
$ csc -s clutter.scm -C "`pkg-config --cflags clutter-1.0`" -L
"`pkg-config --libs clutter-1.0`"
$ csi clutter.so
[...]
#;1> (main)
Segmentation fault
Likewise, the following file using lazy-ffi has the same problem:
http://gist.github.com/847871#file_clutter_lazy.scm
FWIW it seems that removing any reference to clutter_text solves the
problem, which might point to Clutter as the troublemaker, BUT both
files above work perfectly on OS X with the same versions of both
Chicken and Clutter, so I'm not sure. Also, removing the entrance of
clutter_main (the GUI loop) doesn't help. I might just be missing some
compilation flags but I'm pretty much in the dark.
Any ideas?
Evan
- [Chicken-users] Segfaults with shared library, foreign code,
Evan Hanson <=