Check out the lib/system/posix.cpp module in k7.  It creates a "file"
object that has an internal field set to a FILE* pointer.  This object
is returned from the fopen function.

If you try to sniff the object in JS, you'll just see {}.  But in C++,
you can get at the internal field.  That's how the fread/fwrite
functions work.

--i

On Mar 9, 2:31 am, Stephan Beal <[email protected]> wrote:
> On Mar 9, 9:01 am, "Christian 'Little Jim' Plesner"
>
> <[email protected]> wrote:
> > You can't pass raw externals into javascript.  As you've notices that
> > can easily cause v8 to crash (or, worse, not crash and then behave
> > randomly).  The only safe way to use an external is to store it in an
> > internal field of an object and then pass the object into javascript.
> > That has the added benefit of making it easy to add a toString.
>
> Damn... and i've been passing around Externals this whole time (in
> fact, the whole ncurses and sqlite3 bindings are based on them - it
> works as long as you don't try to dereference one!).
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to