Send Guile-user mailing list submissions to
address@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.gnu.org/mailman/listinfo/guile-user
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Guile-user digest..."
Today's Topics:
1. compiling and linking a trivial guile example (Ido Yehieli)
2. Re: compiling and linking a trivial guile example
(Chusslove Illich)
3. Re: compiling and linking a trivial guile example
(address@hidden)
----------------------------------------------------------------------
Message: 1
Date: Wed, 05 Apr 2006 12:53:42 +0200
From: Ido Yehieli <address@hidden>
Subject: compiling and linking a trivial guile example
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,
I've contemplating embedding guile as a scripting language in one
of my c++ applications.
I've been reading the reference manual, and tried compiling the first
example
(from
http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Linking-Guile-into-Programs.html#Linking-Guile-into-Programs):
*****start simple-guile.c*****
#include <stdlib.h>
#include <libguile.h>
static SCM
my_hostname (void)
{
return scm_str2string (getenv ("HOSTNAME"));
}
static void
inner_main (void *data, int argc, char **argv)
{
scm_c_define_gsubr ("my-hostname", 0, 0, 0, my_hostname);
scm_shell (argc, argv);
}
int
main (int argc, char **argv)
{
scm_boot_guile (argc, argv, inner_main, 0);
return 0; /* never reached */
}
***** end simple-guile.c*****
like instructed, with:
gcc -o simple-guile simple-guile.c -lguile
However, i get this error message:
/tmp/ccerLXy4.o: In function `my_hostname':simple-guile.c:(.text+0x16):
undefined reference to `scm_str2string'
I tried also compiling it with:
gcc -o simple-guile simple-guile.c -lguile -lguile-ltdl -lqthreads
-lpthread -lcrypt -lm
because 'guile-config link' gave the following:
-lguile -lguile-ltdl -lqthreads -lpthread -lcrypt -lm
but to no avail. guile-config compile returns an empty line.
What am I doing wrong?
Thanks,
Ido Yehieli.
------------------------------
Message: 2
Date: Wed, 5 Apr 2006 14:05:32 +0200
From: Chusslove Illich <address@hidden>
Subject: Re: compiling and linking a trivial guile example
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset="utf-8"
[: Ido Yehieli :]
return scm_str2string (getenv ("HOSTNAME"));
[...]
/tmp/ccerLXy4.o: In function `my_hostname':simple-guile.c:(.text+0x16):
undefined reference to `scm_str2string'
scm_str2string doesn't seem to exist. If you use -Wall when compiling,
it'll warn about implicit declaration.
Use scm_makfrom0str for deep copy, or scm_take0str for shallow copy (this
all Guile 1.6, don't know about 1.8).