Code Monkey home page Code Monkey logo

node-cpp-modules's Introduction

node-cpp-modules's People

Contributors

filirom1 avatar kkaefer avatar mscdex avatar reregistered avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-cpp-modules's Issues

why no v8 code in AsyncWork

I have some work to do in AsyncWork, like transforming c struct into v8::Object. So I have to write v8 code in AsyncWork.
How can I manage this?

06_objects - assert when calling modulename.MyObject

in 06_objects/run.js , if I change:

var obj = new modulename.MyObject(42);

to:

var obj = modulename.MyObject(42);

I get:

Assertion failed: (handle->InternalFieldCount() > 0), function Wrap, file ../src/node_object_wrap.h, line 62.

naturally, this is not the intended usage, but a Javascript error would be nicer than a c++ assertion failure

baton.request?

Why assign the baton to baton.request when you can also assign the baton to you uv_workt_t request? Or is this just convention?

Module template

I really appreciate this tutorial, excellent work, and so necessary.

It'd be helpful to have a folder with a complete module template including:

  • a module constant (e.g. module.CONST)
  • object constructor defining member variable with default value
  • sync object method returning an array of sample values: [ 123, 'string', true, null, { m:1 }, new Buffer('stuff') ]
  • async object method with a baton & baton subtype, and TryCatch for callback invocation
  • uv_async use from the thread pool routine (maybe this is a separate tutorial folder)

And provide limited comments to document where the user should add further definitions and logic.

If you like the idea, I'd be glad to submit patches...

Use v8::Signature, and other problems with Object example

Problem 1)
You call ObjectWrap::Unwrap, which grabs the original pointer from This().
Shouldn't it be using Holder() and not This() ?

Problem 2)
Your 06_objects example is missing a critical part of the example - v8::Signature for type safety.
see line 489 here:
https://github.com/laverdet/node-fibers/blob/master/src/fibers.cc

Problem 3)
You create a Persistent global handle for constructor, and then do nothing with it.
This example also won't work for other v8 embedders who might be using v8 in multiple Isolates and threads.

Instead, it should be a plain Local handle (no global constructor handle), and use the Signature technique to ensure type safety.

Update build instructions

The README.md files for the examples say to run:
npm build

Doing this does nothing on node.js 0.10.26. However, if you do:
node-gyp configure
node-gyp build

It builds the C++ and then do:

node run.js

You are able to use the examples. You may want to update the docs since in general the people using these examples are total newbs to building native C++ extensions for node (like me!). Thanks a lot for contributing these examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.