Skip to content

Storing callbacks (v8::value::Function) in a struct #24

@jeromegn

Description

@jeromegn

Hey, I know this repo is not maintained anymore, but thought I'd give it a shot.

I had the hardest time storing a v8 Function in a struct. Here's what I was encountering: https://gist.github.com/jeromegn/40727cf0eaa8e18734b0822b5ffd14bc

With a little help from IRC, I was able to get it to work by wrapping the value::Function with a Rc<RefCell<value::Function>>, but I don't think that's the right way?

I wish this was maintained, it's a really good bindings implementation. There aren't many out there given the complexity of v8.

Also, worth noting building this project is a bit broken (I'm not entirely sure which environment variables to use, and they seem to assume a directory structure.) I was able to build everything by putting v8 in /usr/local/{lib,include} and not using any environment variables.

I used v8 5.7.x from the ruby libv8 gem which made this entirely more easy. I bet you could link to it in the readme for a very easy way to install v8 for a bunch of platforms. All you have to do is download the gem, untar (a gem is just a tarball) and get to the vendor folder with pre-compiled v8 for your platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions