Skip to content

Buffer::New (with Finalizer) has documentation discrepancy #383

@computerquip

Description

@computerquip

I'm using new rather than malloc() in my C++ module. When I went to add a custom 'finalizer', it was giving:

napi-inl.h(156): error C2197: 'Finalizer': too many arguments for call

Looking at that line given, it turns out that the finalizer requires you accept an Napi::Env variable first and then the data you initially gave which is contrary to the documentation here:

It must implement operator(), accept a T* (which is the external data pointer), and return void.

I'm not sure which is right here. I don't have any need for the Napi::Env variable and can't think of any reason to use it. Also, it would appear ArrayBuffer has similar documentation issues anything that accepts a finalizer has similar documentation issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions