unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Rohan Drape <rohan.drape@gmail.com>
To: guile-user@gnu.org
Subject: r6rs and posix sockets
Date: Sat, 23 Jan 2021 12:00:54 +1100	[thread overview]
Message-ID: <CAHnM+yYPd2pOjigvhPYVA_=7_=1t=LnuqGHFVwGEz0WkhfgeFA@mail.gmail.com> (raw)

hello list

a very simple question i hope

how do we access the guile posix/sockets functions from within an r6rs
library?

in ikarus there is (import (ikarus)), is it something similar?

i see they are automatically present in the interpreter

best,
rohan

$ guile --r6rs
GNU Guile 3.0.4
[...]
scheme@(guile-user)> socket
$1 = #<procedure socket (_ _ _)>
scheme@(guile-user)>
$ cat test.scm
#!r6rs
(library (test)
  (export udp-open)
  (import (rnrs))
  (define udp-open
    (lambda (h p)
      (let ((s (socket PF_INET SOCK_DGRAM 0)))
        (connect s AF_INET (inet-pton AF_INET h) p)
        (list s h p)))))
$ guile --r6rs
GNU Guile 3.0.4
[...]
scheme@(guile-user)> (import (test))
;;; compiling /home/rohan/opt/lib/r6rs/test.scm
;;; test.scm:9:0: warning: possibly unbound variable `socket'
;;; test.scm:9:0: warning: possibly unbound variable `PF_INET'
;;; test.scm:9:0: warning: possibly unbound variable `SOCK_DGRAM'
[...]


             reply	other threads:[~2021-01-23  1:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-23  1:00 Rohan Drape [this message]
2021-01-23  5:10 ` r6rs and posix sockets John Cowan
2021-01-23  8:53   ` Rohan Drape

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='CAHnM+yYPd2pOjigvhPYVA_=7_=1t=LnuqGHFVwGEz0WkhfgeFA@mail.gmail.com' \
    --to=rohan.drape@gmail.com \
    --cc=guile-user@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).