unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* compiling and linking a trivial guile example
@ 2006-04-05 10:53 Ido Yehieli
  2006-04-05 12:05 ` Chusslove Illich
  0 siblings, 1 reply; 3+ messages in thread
From: Ido Yehieli @ 2006-04-05 10:53 UTC (permalink / raw)


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.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compiling and linking a trivial guile example
  2006-04-05 10:53 Ido Yehieli
@ 2006-04-05 12:05 ` Chusslove Illich
  0 siblings, 0 replies; 3+ messages in thread
From: Chusslove Illich @ 2006-04-05 12:05 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 477 bytes --]

> [: 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).

-- 
Chusslove Illich (Часлав Илић)

[-- Attachment #1.2: Type: application/pgp-signature, Size: 191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compiling and linking a trivial guile example
@ 2006-04-05 14:30 dsmich
  0 siblings, 0 replies; 3+ messages in thread
From: dsmich @ 2006-04-05 14:30 UTC (permalink / raw)
  Cc: guile-user

---- Chusslove Illich <caslav.ilic@gmx.net> wrote: 
> > [: 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).

Guile 1.8 uses scm_from_locale_string.

-Dale



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-05 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-05 14:30 compiling and linking a trivial guile example dsmich
  -- strict thread matches above, loose matches on Subject: below --
2006-04-05 10:53 Ido Yehieli
2006-04-05 12:05 ` Chusslove Illich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).