On Sat, Sep 21, 2013 at 7:22 PM, ~flow <[email protected]> wrote:
> so the failure to compile is not inherent to an unstable node distro, it's
> just a (rather pervasive) accident of the API that a given module happens to
> use, right?
>
> this seems to imply that many unmaintained modules will not be available in
> 0.12 unless fixes get published.
>
> is there any guide how to migrate C code from 0.10 to 0.11 and on?

The two main changes are as follows:

* Persistent<T> no longer derives from Handle<T>.  To recreate the
Handle from a Persistent, call Local<T>::New(isolate, persistent).
You can obtain the isolate with Isolate::GetCurrent() (but note that
Isolate::GetCurrent() will probably go away in newer versions of V8.)

* The prototype of C++ callbacks and accessors has changed.  Before,
your function looked like this:

    Handle<Value> MyCallback(const Arguments& args) {
      HandleScope handle_scope;
      /* Do useful work, then: */
      return handle_scope.Close(Integer::New(42));
      /* Or: */
      return handle_scope.Close(String::New("hello"));
      /* Or: */
      return Null();
    }

  In v0.11 and v0.12 that becomes:

    void MyCallback(const FunctionCallbackInfo<Value>& args) {
      Isolate* isolate = args.GetIsolate();
      HandleScope handle_scope(isolate);
      /* Do useful work, then: */
      args.GetReturnValue().Set(42);
      /* Or: */
      args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello"));
      /* Or: */
      args.GetReturnValue().SetNull();
    }

There have been more changes but these two impact every native add-on.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to