by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Pavel Medvedev
    @pmed
    actually, when a v8::Isolate has a long live time and there are no many v8pp bindings, I don't think this is a significant issue with the non-freed dynamic memory
    xiolec
    @xiolec

    So, anyways I put the dynamic external data into a static class per isolate and just deleted them when the isolate was done. Which works fine for me now. Though I'm curious as to why it was crashing to begin with.

    So, when the weak callback was called to delete the external data it went into that function and deleted the external data fine. then when exiting it went back into global-handlers.cc -PostGarbageCollectionProcessing function. and crashes at CHECK(state() != NEAR_DEATH); Do you know what would cause it to crash here?

    Pavel Medvedev
    @pmed
    I don't know the cause, probably it's an internal GC check in V8 debug version
    btw, I added a v8pp::class_::destroy() function to delete all wrapped C++objects and the class_ instance
    xiolec
    @xiolec

    I uploaded my changes to github. my version of v8pp::context is not finished though. A lot of that was testing around to see what works. Though I eventually will add a callback function for context creation that would allow you to create the global object as a v8pp::class_.

    I added interceptors to v8pp::class_. which is similar to the property. any_object.h was just stuff I was testing out. hopefully allowing a cpp function to accept either a cpp object or a v8 object. I just added v8pp::Function to that file which allows for accepting a function that is either from v8 or from cpp and if the object is passed to v8 with a cpp function that function would be converted so that It could be used within v8. also with that I enabled using std::function as a function withing v8pp.

    reference_tracker.h is just for debugging memory leaks. I should probably change it to a macro.

    v8object_base allows for a persistent object to be stored for a class. I.e. if you put it as a base class on an object that object will remain in memory until it the object is destroyed in cpp. destroying the isolate that the object is attached to also destroys the persistent object. class can also detect if the a class has the base class then just get the v8 object from there instead of searching for the v8 object.
    v8ppdebug.h was just some interceptors that I was using for debugging. they get added to every class object that doesn't already have interceptors when the debugging is enabled.
    xiolec
    @xiolec

    I also added some destroy functions in class_ though those were kinda just put together quickly. also added set_js_const which allows to add a const value on to the js function.

    the interceptors don't include all the static asserts needed. Haven't really tried merging it to your version yet. I need to redo all my changes to v8pp::context first lol.

    also I added the external_data to its own file. and tracked the data that was created and deleted all the data when the isolate is destroyed. I might also add a comparison function to the external_data holder. so that the same data wont be created multiple times but instead is just searched for.
    Yeah, i think I need to completely redo all my changes to the v8pp::context lol
    xiolec
    @xiolec

    Context.hpp is now updated to use callback functions to create a global object with class_

    Added convert functions to automatically convert an object into v8 without importing/referencing first

    Added insertobject functions in class to insert pointers into a v8 object that was already created

    - Requires 2 aligned pointer slots. 
    xiolec
    @xiolec
    Do you know if its possible to create two v8::contexts with the same objecttemplate? Can't get it to stop crashing when the new context is made and the old one still exists.
    xiolec
    @xiolec
    never mind think I found the problem. I was adding instances of objects to the template after it was created on the first context.
    Tim Janik
    @tim-janik
    @pmed can I close #52 and #49 or do you have any reason to keep them open?
    Alexey Zasenko
    @0xDAD
    Hi all! I believe here is the proper place to ask questions like mine. @pmed, have you considered adding CMake support to the project?
    Pavel Medvedev
    @pmed
    Hi @0xDAD,
    Yes, it would be great to have the CMake support. Pull requests are welcomed! :)
    while the library can be mostly used as a header-only, it would be good to have CMake support for quick starting with examples or tests
    Alexey Zasenko
    @0xDAD
    Also, cmake config file could help easily embed and customize the library into user projects. Thanks. Will make request if have something interesting
    Pavel Medvedev
    @pmed
    Super, thanks!
    Alexey Zasenko
    @0xDAD
    Got linking error in case of using v8pp::context and V8PP_HEADER_ONLY defined. Was it intended not to use contexts in header-only implementation? Or maybe I did smth wrong? Thanks
    Alexey Zasenko
    @0xDAD
    error LNK2019: unresolved external symbol "public: __thiscall v8pp::context::context(class v8::Isolate *,class v8::ArrayBuffer::Allocator *,bool)" (??0context@v8pp@@QAE@PAVIsolate@v8@@PAVAllocator@ArrayBuffer@3@_N@Z) 
    error LNK2019: unresolved external symbol "public: __thiscall v8pp::context::~context(void)" (??1context@v8pp@@QAE@XZ)
    Adding context.cpp to the project solves the problem.
    Pavel Medvedev
    @pmed
    This v8pp::context is used mostly for test and in a couple of projects those had V8 embedded. Intent for V8PP_HEADER_ONLY was to use the library without installation in projects for Node.js native add-ons. There you could just add the library as an NPM dependency in package.json. See also these comments: https://github.com/pmed/v8pp/issues/75#issuecomment-397034400 https://github.com/pmed/v8pp/issues/75#issuecomment-397249100
    Alexey Zasenko
    @0xDAD
    Got it. I'm trying to use the library for wrapping business objects for V8 engine embedded into my app. I found it quite straightforward and cppish) Thanks for your time and for sharing!
    Pavel Medvedev
    @pmed
    You are welcome! I've created this library for one similar, so v8pp was designed from requirements to that project.
    David Warford
    @redstonedash
    Hello. I am confused on how I am supposed to include v8 into my project. do i just add the v8pp directory as an include directory?
    David Warford
    @redstonedash
    also all the examples seem to include node.h but i don't have a node.h
    Pavel Medvedev
    @pmed
    Hello! This library is a wrapper for V8, that should also be a dependency in your project. Please refer the V8 documentation how to embed it into your project. And yes, v8pp is a header-only library, so you can add its v8pp subdirectory into your project includes path.
    v8pp/examples contains native Node.js addons, implemented with v8pp. You could read how to build the native Node.js in the Node.js documentation: https://nodejs.org/dist/latest-v12.x/docs/api/addons.html#addons_building
    David Warford
    @redstonedash
    oh. i guess i was misinformed. somone said this game with the v8 binaries and thats why i was trying to use it because building v8 was a struggle for me
    Pavel Medvedev
    @pmed
    Here is also some documentation in v8pp: https://github.com/pmed/v8pp/blob/master/docs/addons.md
    Pavel Medvedev
    @pmed
    ok, v8 building is not a trivial task. I've made a project to build V8 on windows into a NuGet package: https://github.com/pmed/v8-nuget