<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div>Hi,<br>
The wrapper example below works great. Seems like -DWITH_MAIN, and -DUSE_SND=0 adds some special help. Thanks so much for that info.<br>
<br>
I'm moving on also to look at cload.scm now, but confused about the s7 manual example compile lines which shows an "ex1.c". I wasn't clear about what is ex1.c, or maybe my brain is just not reading the cload example correctly.<br>
<pre class="indented">gcc -c s7.c -I.
gcc -o ex1 ex1.c s7.o -lm -I. -ldl -Wl,-export-dynamic
ex1
> (load "cload.scm")<br>...</pre>
Regards,<br>
Jim<br>
-----------<br>
gcc -fpic -c add1.c<br>
gcc -shared -Wl,-soname,libadd1.so -o libadd1.so add1.o -lm -lc<br>
gcc s7.c -o repl -fpic -DWITH_MAIN -I. -ldl -lm -Wl,-export-dynamic -DUSE_SND=0<br>
<br>
>./repl<br>
> (load "libadd1.so" (inlet 'init_func 'add1_init))<br>
> (add1 2)<br>
<br>
<br>
#include <stdlib.h><br>
#include "s7.h"<br>
<br>
static s7_pointer add1(s7_scheme *sc, s7_pointer args)<br>
{<br>
if (s7_is_integer(s7_car(args)))<br>
return(s7_make_integer(sc, 1 + s7_integer(s7_car(args))));<br>
return(s7_wrong_type_arg_error(sc, "add1", 1, s7_car(args), "an integer"));<br>
}<br>
<br>
void add1_init(s7_scheme *sc);<br>
void add1_init(s7_scheme *sc)<br>
{<br>
s7_define_function(sc, "add1", add1, 1, 0, false, "(add1 int) adds 1 to int");<br>
}</div>
<br>
</div>
</body>
</html>