On 7/6/07, foobar <[EMAIL PROTECTED]> wrote:
Great thanks. Just to be sure i've done it correctly. Here is an example on how i would return a list of one string element. (define return-a-list-with-string-elt (foreign-primitive scheme-object () "char str[] = \"hallo\";" "C_word *sstr = C_alloc(C_SIZEOF_STRING(strlen(str)));" "C_return(C_h_list(1,C_string2(&sstr,str)));")) This code works as expected. It does hopefully allso not leak memory.
I'd perhaps do it this way: (foreign-primitive scheme-object () "char *str[] = \"hallo\";" "C_word *buf = C_alloc(C_SIZEOF_STRING(strlen(str)) + C_SIZEOF_PAIR);" "C_word str = C_string2(&buf, str);" "C_return(C_a_i_list(&buf, 1, str));") cheers, felix _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users