This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Alexander Asteroth writes: > Does gh_list work? > > The following c-source illustrates the problem: > > #include <guile/gh.h> > > void main_prog(int argc, char **argv) { > SCM l1, l2; > l1 = SCM_LIST2(gh_str02scm("filename"), gh_str02scm("bla")); > gh_display(l1); gh_display(gh_str02scm(" is OK"));gh_newline(); > l2 = gh_list(gh_str02scm("filename"), gh_str02scm("bla")); > } > > int main (int argc, char **argv) {gh_enter (argc, argv, main_prog);} > > => > (filename bla) is OK > Segmentation fault > > Did I got somthing wrong on how gh_list should work? > > Any help? looks like `gh_list()' is really `scm_listify()', which has the following as part of its implementation: while (elt != SCM_UNDEFINED) { *pos = scm_cons (elt, SCM_EOL); pos = SCM_CDRLOC (*pos); elt = va_arg (foo, SCM); } what is happening is that the varargs walker `elt' is not finding `SCM_UNDEFINED' and so walks off and weird things happen. you should use something like: l2 = gh_list (something, something_else, SCM_UNDEFINED); happy hacking, thi