unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: joakim@verona.se
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-user@gnu.org
Subject: Re: gnome-clutter + repl?
Date: Tue, 27 Sep 2011 11:19:31 +0200	[thread overview]
Message-ID: <m3hb3yxrz0.fsf@chopper.vpn.verona.se> (raw)
In-Reply-To: <87d3ep90pn.fsf@gnu.org> ("Ludovic \=\?iso-8859-1\?Q\?Court\=E8s\?\= \=\?iso-8859-1\?Q\?\=22's\?\= message of "Sat, 24 Sep 2011 21:53:08 +0200")

ludo@gnu.org (Ludovic Courtès) writes:

> Hi Joakim!
>
> joakim@verona.se skribis:
>
>> Anyway, the problem is that clutter needs its own event loop,
>> clutter-main, so then I can't simply use the Guile REPL as I'd like.
>
> Maybe you could start a REPL server?  (See the (system repl server)
> module.)
>
> You could then use Geiser to connect to it (M-x geiser-connect), which
> should allow you to get a nice development environment.
>
> Hope this helps,
> Ludo’.

Okay this approach started out nicely!

The C code boots both Guile and Clutter in the same thread(I think).

I can access the REPL port with nc. Thus, bliss and happiness so far!

However. Unevitable this happy narrative is disturbed by problems.

I am unable to export a C function to Guile. I've tried snarfing and a
more primitive approach as well. The C function doesn't wind up
available in the REPL. All I get is:

nc localhost 37146
...
(myloadfromdata "")
;;; socket:9:17: warning: possibly unbound variable `myloadfromdata'
socket:9:17: In procedure #<procedure b51600 at socket:9:17 ()>:
socket:9:17: In procedure module-lookup: Unbound variable: myloadfromdata


The only difference I can think of as compared to the documentation is
that inner main looks like this at the moment:

static void
inner_main (void *closure, int argc, char **argv)
{
     scm_c_define_gsubr ("myloadfromdata", 1, 0, 0, myloadfromdata);

  printf("starting guile server\n");

  scm_c_primitive_load("init.scm");
  printf("starting clutter\n");  
  main_view(argc, argv);
}

If I instead use        scm_shell (argc, argv); rather than
scm_c_primitive_load("init.scm"); the function is accessible,
so maybe there is some namespace issue?

init.scm looks like:
(define-module (mytest)
  #:use-module (system repl server))

(spawn-server)


-- 
Joakim Verona



  reply	other threads:[~2011-09-27  9:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-24 14:57 gnome-clutter + repl? joakim
2011-09-24 19:29 ` Mark H Weaver
2011-09-24 19:53 ` Ludovic Courtès
2011-09-27  9:19   ` joakim [this message]
2011-09-28 13:02     ` Ludovic Courtès
2011-09-28 13:30 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3hb3yxrz0.fsf@chopper.vpn.verona.se \
    --to=joakim@verona.se \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).