<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1469716374681_11245">Try manually loading the syntax-case library in test.scm before you use it.  With:</div><div id="yui_3_16_0_ym19_1_1469716374681_11246"><br id="yui_3_16_0_ym19_1_1469716374681_11247"></div><div id="yui_3_16_0_ym19_1_1469716374681_11216"></div><div id="yui_3_16_0_ym19_1_1469716374681_11248">(load "~~/lib/syntax-case")</div><div dir="ltr" id="yui_3_16_0_ym19_1_1469716374681_11249"><br id="yui_3_16_0_ym19_1_1469716374681_11250"></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Friday, July 29, 2016 8:34 AM, ochi n <ochi12@hotmail.com> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv2151594006">

 
<style type="text/css"><!--#yiv2151594006 P {margin-top:0;margin-bottom:0;}--></style>

<div dir="ltr">
<div id="yiv2151594006divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri, Arial, Helvetica, sans-serif;">
<div>Hi all, I'm trying to compile a simple program using macros but for some reason it won't work.</div>
<div>This is the code in test.scm</div>
<div><br>
</div>
<div></div>
<div>    (define-syntax while<br>
<span>    </span>  (syntax-rules ()<br>
<span>    </span>    ((while condition body ...)<br>
<span>    </span>     (let loop ()<br>
<span>    </span>       (if condition<br>
<span>    </span>           (begin<br>
<span>    </span>             body ...<br>
<span>    </span>             (loop))<br>
<span>    </span>           #f)))))<br>
<br>
<span>    </span>(define x 0)<br>
<span>    </span>(while (< x 5)<br>
<span>    </span>  (set! x (+ x 1))<br>
<span>    </span>  (print x))<br>
<br>
When I load the file into the interpreter (with the -:s option) it works, but when I try to compile it (using gambitc -:s -exe test.scm) I get the following error:<br>
<div>*** ERROR -- missing or invalid linking information for module "/usr/lib/gambit-c/_gambit"<br>
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib/crt1.o: In function `_start':<br>
(.text+0x20): undefined reference to `main'<br>
test.o: In function `___setup_mod':<br>
test.c:(.text+0xa): undefined reference to `___G__20_test'<br>
test.o: In function `___init_mod':<br>
test.c:(.text+0x26): undefined reference to `___G__20_test'<br>
test.o: In function `___H__20_test':<br>
test.c:(.text+0x113): undefined reference to `___G__24_sc_2d_put_2d_cte'<br>
test.c:(.text+0x181): undefined reference to `___G__24_sc_2d_put_2d_cte'<br>
test.c:(.text+0x1a2): undefined reference to `___G__24_sc_2d_put_2d_cte'<br>
test.c:(.text+0x1f3): undefined reference to `___G__24_sc_2d_put_2d_cte'<br>
test.c:(.text+0x214): undefined reference to `___G_x'<br>
test.c:(.text+0x24d): undefined reference to `___G_x'<br>
test.c:(.text+0x3a6): undefined reference to `___G_x'<br>
test.c:(.text+0x450): undefined reference to `___G_x'<br>
test.c:(.text+0x59b): undefined reference to `___G__24_syntax_2d_dispatch'<br>
test.c:(.text+0x60f): undefined reference to `___G__24_syntax_2d_dispatch'<br>
test.c:(.text+0x6a0): undefined reference to `___G_syntax_2d_error'<br>
test.c:(.text+0x6fa): undefined reference to `___G_syntax_2d_error'<br>
test.o: In function `____20_test':<br>
test.c:(.text+0xd38): undefined reference to `___S__2a_top_2a_'<br>
test.c:(.text+0xd46): undefined reference to `___S_any'<br>
test.c:(.text+0xd62): undefined reference to `___S_body'<br>
test.c:(.text+0xd70): undefined reference to `___S_condition'<br>
test.c:(.text+0xd8c): undefined reference to `___S_each_2d_any'<br>
test.c:(.text+0xd9a): undefined reference to `___S_global'<br>
test.c:(.text+0xdc4): undefined reference to `___S_loop'<br>
test.c:(.text+0xdd2): undefined reference to `___S_ribcage'<br>
test.c:(.text+0xdee): undefined reference to `___S_syntax_2d_object'<br>
test.c:(.text+0xe18): undefined reference to `___S_top_2d_ribcage'<br>
test.c:(.text+0xe34): undefined reference to `___S_x'<br>
collect2: error: ld returned 1 exit status</div>
<br>
I tried compiling with the interactive mode using <br>
    (compile-file-to-target "test.scm")<br>
    (quit)<br>
    gambitc -exe test.c<br>
and it compiles well, but when I try to run the exe I get:<br>
<div>    *** ERROR IN | test| -- Operator is not a PROCEDURE<br>
<span>    </span>(#!unbound<br>
<span>    </span> '#(syntax-object while ((top) #(ribcage #(while) #((top)) #(while))))<br>
<span>    </span> '#<procedure #2><br>
<span>    </span> '*top*)<br>
<br>
No matter how hard I try I can't compile any code that makes use of macros. Any help appreciated!<br>
</div>
<span>(I'm using Arch Linux and I installed gambit from Arch's repositroy, everything else apart from macros works well</span>)<br>
</div>
<div></div>
</div>
</div>
</div><br>_______________________________________________<br>Gambit-list mailing list<br><a ymailto="mailto:Gambit-list@iro.umontreal.ca" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br><a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br><br><br></div>  </div> </div>  </div></div></body></html>