Open GoogleCodeExporter opened 9 years ago
Thank you for your message and very nice information.
I will consider dynamic bindings. :)
BTW, I'm now writing Ypsilon API Reference (API not fixed yet).
Current draft is available at http://www.littlewing.co.jp/ypsilon/doc-draft/
Your comments are very welcome!
-- fujita
Original comment by y.fujita...@gmail.com
on 21 Jan 2009 at 3:33
Hi
rotty also approached me about this, and what he says makes a lot of sense.
The solution I have to offer is simple though, and I would think it be similar
in
Ypsilon.
(define (make-ffi-callout return-type arg-types)
(eval `(ffi-callout ,return-type ,arg-types)
(environment '(ironscheme clr))))
Cheers
leppie
Original comment by xacc....@gmail.com
on 24 Jan 2009 at 10:03
Thank you for your message!
Yes, your solution is simple, portable, and easy to maintain. :)
However, because Ypsilon's eval is too slow for practical use (current version
uses
fake library to implement eval), I have decided to implement it in the core
library.
--fujtia
Original comment by y.fujita...@gmail.com
on 27 Jan 2009 at 12:36
I think the issues originally raised in these bug are adressed in
Ypsilon SVN now.
However, I'd like to add one request: it should be possible to
retrieve the shared object handle for the current process. One usecase
for this is the following:
I link ypsilon against libtcmalloc (from google-perftools) when
hunting for memory leaks. Now all DSOs I load will use malloc()/free()
from libtcmalloc, hence when I accept/pass dynamically allocated
memory from/to the DSOs and ownership of that memory is transferred, I
have to make sure I'm using the *right* malloc()/free() from Scheme
(i.e. the one of libtcmalloc). Hence code like this will break badly:
(define libc (load-shared-object
(cond (on-linux "libc.so.6")
(else
(error 'libc "unsupported system")))))
(define malloc (c-function libc "libc" void* malloc (size_t)))
(define free (c-function libc "libc" void free (void*)))
I've attached a patch that allows one to retrieve the process's DSO
handle by calling `load-shared-object' with zero arguments (maybe the
name does not quite match the semantics then, as no shared object is
actually loaded in that case). Another possibility to fix this
*specific* use case would be to define malloc()/free() as subrs inside
the C++ code, but there might be other occasions where the feature
added by the attached patch is useful. Note that the patch is untested
on Windows.
Original comment by rott...@gmail.com
on 22 Apr 2009 at 2:40
Attachments:
I have updated load-shared-object in revision 429 as you suggested.
Thank you! :)
-- fujita
(I keep this issue open until I finish the next release version. Any
suggestions and
comments are very welcome!)
Original comment by y.fujita...@gmail.com
on 26 Apr 2009 at 2:23
It would be nice for symmetry to have `unsigned-long-long' and
`signed-long-long'
types in the FFI. While these are most certainly synonymous to `uint64_t' and
`int64_t' on all platforms supported by Ypsilon, in theory they aren't always
the same.
Original comment by rott...@gmail.com
on 6 Jun 2009 at 4:17
Thank you for your suggestion!
I have added 'long-long' and 'unsigned-long-long' to revision 488. :-)
-- fujita
Original comment by y.fujita...@gmail.com
on 7 Jun 2009 at 2:28
Original issue reported on code.google.com by
rott...@gmail.com
on 21 Jan 2009 at 12:42