This is actually all fixed.<br><br>For reasons I have no idea why, they can be fixed via:<br><br>1) using "compile-file" instead of "compile-file-to-c & link-flat"<br><br>2) using cc-options: "-Wno-write-strings"<br>
<br><div class="gmail_quote">On Mon, Feb 23, 2009 at 11:38 PM, lowly coder <span dir="ltr"><<a href="mailto:lowlycoder@huoyanjinjing.com">lowlycoder@huoyanjinjing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br><br>  There are two compiler warnings I want to get rid of. Please enlighten me. (1) is from gcc, (2) is from gsc.<br><br>(1) this one deals with const char * vs char *<br>if I try to do (pointer char), I get the following error:<br>

~/test$ cat error1.scm; echo '-----'; gsc error1.scm; echo '-----'; gsc -link error1; gsi -e '(load "error1")'<br>(c-declare #<<c-declare-end<br>#include <stdio.h>           <br>

void foo(const char* str) {<br>  fprintf(stderr, "printing: %s\n", str);<br>}<br>c-declare-end<br>)<br><br>(define foo (c-lambda ((pointer char)) void "foo"))<br><br>(foo "hello world")<br>-----<br>

error1.c:45: warning: deprecated conversion from string constant to ?char*?<br>error1.c:51: warning: deprecated conversion from string constant to ?char*?<br>error1.c:51: warning: deprecated conversion from string constant to ?char*?<br>

error1.c:51: warning: deprecated conversion from string constant to ?char*?<br>error1.c:191: warning: deprecated conversion from string constant to ?char*?<br>-----<br>*** ERROR IN ##load -- (Argument 1) Can't convert to C pointer<br>

(foo "hello world")<br><br><br>now, if I use char-string instead, I get an annoying error while compiling with gcc:<br><br>~/test$ cat error2.scm; echo '-----'; gsc error2.scm; echo '-----'; gsc -link error2; gsi -e '(load "error2")'<br>

(c-declare #<<c-declare-end<br>#include <stdio.h>           <br>void foo(const char* str) {<br>  fprintf(stderr, "printing: %s\n", str);<br>}<br>c-declare-end<br>)<br><br>(define foo (c-lambda (char-string) void "foo"))<br>

<br>(foo "hello world")<br>-----<br>error2.c:42: warning: deprecated conversion from string constant to ?char*?<br>error2.c:42: warning: deprecated conversion from string constant to ?char*?<br>error2.c:42: warning: deprecated conversion from string constant to ?char*?<br>

error2.c:174: warning: deprecated conversion from string constant to ?char*?<br>-----<br>printing: hello world<br><br><br>I don't want to tell gcc to ignore this error. I want to get gambit to generate correct code. How do I do that?<br>

<br><br><br>(2) This is shown right in section 3.4.2 of the gambit reference manual:<br><br>     $ gsc -link -flat -o foo.o1.c m2 m3<br>     m2:<br>     m3:<br>     *** WARNING -- "cons" is not defined,<br>     ***            referenced in: ("m2.c")<br>

     *** WARNING -- "map" is not defined,<br>     ***            referenced in: ("m3.c")<br>     *** WARNING -- "newline" is not defined,<br>     ***            referenced in: ("m3.c")<br>

     *** WARNING -- "write" is not defined,<br>     ***            referenced in: ("m3.c")<br><br>Is there something I can put in m2.scm / m3.scm like "don't worry about cons / map / newline / write" ?<br>

<br>     ; File: "m2.scm"<br>     (c-declare "extern int power_of_2 ();")<br>     (define pow2 (c-lambda (int) int "power_of_2"))<br>     (define (twice x) (cons x x))<br><br>     ; File: "m3.scm"<br>

     (write (map twice (map pow2 '(1 2 3 4)))) (newline)<br><br><br><br>aside: I realize these are just small warnings. However, I'm doing alot of C-FFi library wrapping, and it's getting to be more than one screenful of warnings. This is bad as (1) I like things to be clean and (2) it makes it hard to view actual errors since there are so many silly warnings.<br>

<br>Thanks!<br>
</blockquote></div><br>