unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: Passing C pointers through guile
Date: Sun, 06 Jul 2008 21:20:31 +0200	[thread overview]
Message-ID: <87hcb2bz0g.fsf@gnu.org> (raw)
In-Reply-To: Pine.LNX.4.64.0807061808280.5259@ttleush

Hi,

"Kjetil S. Matheussen" <k.s.matheussen@notam02.no> writes:

> I haven't heard of the "uo" field before, but at least using a SMOB
> is really inconvenient, and using an unsigned long for storing
> pointers is really convenient. (BTW. How does swig and gwrap handle
> pointers?)

G-Wrap has "wrapped C types" (WCTs):

  http://www.nongnu.org/g-wrap/manual/Wrapping-a-C-Pointer-Type.html

IIRC, it uses a SMOB containing additional information behind the
scenes.

> I agree with Maciek that it would at least be mind-comforting to have
> functions like scm_to_ptr/etc, although not strictly necessary,
> since using integers works just fine.

`scm_{to,from}_uintptr ()' could be handy (patches welcome!).

That said, using a Scheme integer to represent a pointer wouldn't be
efficient (pointers would likely translate to bignums).

Thanks,
Ludovic.





  reply	other threads:[~2008-07-06 19:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cmu-lmtpd-16223-1215360367-2@mail-imap1.uio.no>
2008-07-06 16:13 ` Passing C pointers through guile Kjetil S. Matheussen
2008-07-06 19:20   ` Ludovic Courtès [this message]
2008-07-09 16:48   ` Greg Troxel
2008-07-09 16:55     ` Kjetil S. Matheussen
2008-07-09 19:54       ` Ludovic Courtès
2008-07-10 15:11       ` Ken Raeburn
2008-07-23 11:19         ` Greg Troxel
2008-07-10 12:54 Kjetil S. Matheussen
  -- strict thread matches above, loose matches on Subject: below --
2008-07-04 22:18 Maciek Godek
2008-07-05 16:59 ` Ludovic Courtès

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=87hcb2bz0g.fsf@gnu.org \
    --to=ludo@gnu.org \
    --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).