[gambit-list] Segfault while importing enum

Vok Vojwo ceving at gmail.com
Wed Nov 2 12:05:56 EDT 2011


I tried to import a Gtk enumeration constant:

;; Local Variables:
;; compile-command: "gsc -cc-options \"`pkg-config --cflags
gtk+-2.0`\" -ld-options \"`pkg-config --libs gtk+-2.0`\" -exe
enum.scm"
;; End:

(c-declare "#include <gtk/gtk.h>")

(c-define-type GtkWindowType "GtkWindowType")

(define gtk-window-toplevel
  ((c-lambda () GtkWindowType "___result = GTK_WINDOW_TOPLEVEL;")))

(write gtk-window-toplevel)

But I get a segmentation fault when I run the program.

When I use int instead of the enum type the code does not segfault:

(define gtk-window-toplevel
  ((c-lambda () int "___result = GTK_WINDOW_TOPLEVEL;")))

Does this mean, that I have to ignore all C enum types and treat them as ints?

The documentation for c-define-type does not say much about enumerations:

http://www.iro.umontreal.ca/~gambit/doc/gambit-c.html#c_002ddefine_002dtype


More information about the Gambit-list mailing list