On Tue, Mar 19, 2019 at 9:41 AM Darin Dimitrov <darin.dimit...@gmail.com> wrote: > > I am trying to associate an internal field with a Local<Function> created > from a Local<FunctionTemplate>: > > Local<FunctionTemplate> ctorFuncTemplate = FunctionTemplate::New(isolate); > > Local<Function> ctorFunc = > ctorFuncTemplate->GetFunction(context).ToLocalChecked(); > > ctorFunc->SetInternalField(0, External::New(isolate, ptr)); > > > This fails with "Internal field out of bounds". > > > I am able to properly set the internal field count on object instances > created from this function: > > > ctorFuncTemplate->InstanceTemplate()->SetInternalFieldCount(1); > > > But what would be the proper way to set the internal field count for the > function instance itself?
It sounds like you should pass the External as the `data` argument to FunctionTemplate::New(). You'll be able to retrieve it in the callback as FunctionCallbackInfo<Value>::Data(). -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.