unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Should we add scm_to_pointer, or just use SCM_POINTER_VALUE?
@ 2012-02-01  6:20 Mark H Weaver
  2012-02-01 10:59 ` Andy Wingo
  2012-02-02 21:07 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Mark H Weaver @ 2012-02-01  6:20 UTC (permalink / raw)
  To: guile-devel

I was chatting with rcfox on #guile, who needed to extract the C pointer
from a SCM pointer object, from C code.  In this case, it was a C
callback created using 'procedure->pointer'.

I tried to discourage him from using SCM_POINTER_VALUE, because it's
undocumented and will embed internal details of our representation into
his binary, but he was undeterred :)

Should we add 'scm_to_pointer'?  For most other accessors, the trend
seems to be to discourage use of C macros and move people over to C
functions instead.  With that in mind, it seems inconsistent to have
people using SCM_POINTER_VALUE for lack of a C function to do this job.

What do you think?

    Mark



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

* Re: Should we add scm_to_pointer, or just use SCM_POINTER_VALUE?
  2012-02-01  6:20 Should we add scm_to_pointer, or just use SCM_POINTER_VALUE? Mark H Weaver
@ 2012-02-01 10:59 ` Andy Wingo
  2012-02-02 21:07 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2012-02-01 10:59 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guile-devel

On Wed 01 Feb 2012 07:20, Mark H Weaver <mhw@netris.org> writes:

> Should we add 'scm_to_pointer'?  For most other accessors, the trend
> seems to be to discourage use of C macros and move people over to C
> functions instead.  With that in mind, it seems inconsistent to have
> people using SCM_POINTER_VALUE for lack of a C function to do this job.
>
> What do you think?

Sounds like a great idea to me.

Cheers,

Andy
-- 
http://wingolog.org/



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

* Re: Should we add scm_to_pointer, or just use SCM_POINTER_VALUE?
  2012-02-01  6:20 Should we add scm_to_pointer, or just use SCM_POINTER_VALUE? Mark H Weaver
  2012-02-01 10:59 ` Andy Wingo
@ 2012-02-02 21:07 ` Ludovic Courtès
  2012-02-02 21:49   ` Andy Wingo
  2012-02-02 22:10   ` Mark H Weaver
  1 sibling, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2012-02-02 21:07 UTC (permalink / raw)
  To: guile-devel

Hello!

Adding ‘scm_to_pointer’ is nice, but ‘SCM_POINTER_VALUE’ is also meant
to be public (and should be documented.)

I’m curious: why would one want to use the FFI’s C API?

Thanks,
Ludo’.




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

* Re: Should we add scm_to_pointer, or just use SCM_POINTER_VALUE?
  2012-02-02 21:07 ` Ludovic Courtès
@ 2012-02-02 21:49   ` Andy Wingo
  2012-02-02 22:10   ` Mark H Weaver
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2012-02-02 21:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Thu 02 Feb 2012 22:07, ludo@gnu.org (Ludovic Courtès) writes:

> I’m curious: why would one want to use the FFI’s C API?

Good question!

A
-- 
http://wingolog.org/



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

* Re: Should we add scm_to_pointer, or just use SCM_POINTER_VALUE?
  2012-02-02 21:07 ` Ludovic Courtès
  2012-02-02 21:49   ` Andy Wingo
@ 2012-02-02 22:10   ` Mark H Weaver
  1 sibling, 0 replies; 5+ messages in thread
From: Mark H Weaver @ 2012-02-02 22:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:
> Adding ‘scm_to_pointer’ is nice, but ‘SCM_POINTER_VALUE’ is also meant
> to be public (and should be documented.)

Okay.

> I’m curious: why would one want to use the FFI’s C API?

Apparently he wanted to create a C callback to a Scheme procedure (using
procedure->pointer), but wanted to do the rest from C.

     Mark



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

end of thread, other threads:[~2012-02-02 22:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01  6:20 Should we add scm_to_pointer, or just use SCM_POINTER_VALUE? Mark H Weaver
2012-02-01 10:59 ` Andy Wingo
2012-02-02 21:07 ` Ludovic Courtès
2012-02-02 21:49   ` Andy Wingo
2012-02-02 22:10   ` Mark H Weaver

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