[nodejs] How do I set breakpoints in, and debug, Node.js C++ code on Windows?
I'm familiar with writing C++ libraries for Node.js, but have never figured out how to debug them using breakpoints, etc. Most of my libraries have been simple enough to not need any real debugging. I'm on Windows and I am unsure of how to go about doing this. Will I need something like gdb, or can Visual Studio debug this code? At the moment, I'm actually trying to look into a github issue relating to Windows, in node. So, that's my specific interest in learning how to debug. Any help is appreciated! -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[nodejs] Re: How do I set breakpoints in, and debug, Node.js C++ code on Windows?
It looks like the solution created by vcbuild.bat, on Windows, is able to just be opened in Visual Studio. The debug settings are all configured and ready to go, too. Pretty sweet! On Wednesday, April 30, 2014 5:20:00 PM UTC-5, Ryan Cole wrote: I'm familiar with writing C++ libraries for Node.js, but have never figured out how to debug them using breakpoints, etc. Most of my libraries have been simple enough to not need any real debugging. I'm on Windows and I am unsure of how to go about doing this. Will I need something like gdb, or can Visual Studio debug this code? At the moment, I'm actually trying to look into a github issue relating to Windows, in node. So, that's my specific interest in learning how to debug. Any help is appreciated! -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[nodejs] How to run node tests on Windows?
Hi all, I'm trying to run the unit tests for node, on Windows. I'm using `vcbuild.bat tests`, but all it does is rebuild the project, it does not run any tests. Is there anything additional that I need to be doing to run these tests? Thanks, Ryan -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[nodejs] Re: How to run node tests on Windows?
Nevermind. For whatever reason, the tests are running now. Ryan On Tuesday, April 29, 2014 10:14:28 AM UTC-5, Ryan Cole wrote: Hi all, I'm trying to run the unit tests for node, on Windows. I'm using `vcbuild.bat tests`, but all it does is rebuild the project, it does not run any tests. Is there anything additional that I need to be doing to run these tests? Thanks, Ryan -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[nodejs] How to properly pass LocalObject as function param?
In a C++ addon, I've got a function in which I instantiate a LocalObject. I want to pass that as an argument to another function. Should the argument be passed as a LocalObject, or PersistentObject? I'm unsure of when I should use either of those. Thanks -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] How to properly pass LocalObject as function param?
Ya immediate function call. My bad for not mentioning that. Ok, I had it passing as a Local, but I didn't know if that was bad or not. I have to admit, the docs for v8, node and libuv are all difficult to merge into one as a beginner. I'm honestly just brute forcing my knowledge of these libraries as much as I can. I make attempts to scan each set of docs for information as to how to do things, and when I cant find it there I go to github looking for examples using code search, and if that fails I go to google. When those all fail I generally go to IRC or here. It's a slow painful progression but it's basically the only way I know how to, at the moment. Ryan On Sunday, November 11, 2012 7:19:15 PM UTC-6, Ben Noordhuis wrote: On Mon, Nov 12, 2012 at 1:54 AM, Ryan Cole ry...@rycole.com javascript: wrote: In a C++ addon, I've got a function in which I instantiate a LocalObject. I want to pass that as an argument to another function. Should the argument be passed as a LocalObject, or PersistentObject? I'm unsure of when I should use either of those. Thanks Immediate function call, not asynchronous? You can pass the object as a Local. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] How to properly pass LocalObject as function param?
Ok awesome, thanks for the reads. Also, just to deliberately ask, what about in async function calls? I'm assuming I'd not use LocalObject? For example, if I were using the baton pattern, would my baton struct use a LocalObject? I've seen examples for callback functions that use PersistentFunction, so that makes me think I'd use PersistentObject to cross those function calls? Thanks, Ryan On Sunday, November 11, 2012 8:53:20 PM UTC-6, Ben Noordhuis wrote: On Mon, Nov 12, 2012 at 2:35 AM, Roger WANG roger...@linux.intel.comjavascript: wrote: Ryan Cole ry...@rycole.com javascript: writes: Ya immediate function call. My bad for not mentioning that. Ok, I had it passing as a Local, but I didn't know if that was bad or not. I have to admit, the docs for v8, node and libuv are all difficult to merge into one as a beginner. I'm honestly just brute forcing my knowledge of these libraries as much as I can. I make attempts to scan each set of docs for information as to how to do things, and when I cant find it there I go to github looking for examples using code search, and if that fails I go to google. When those all fail I generally go to IRC or here. It's a slow painful progression but it's basically the only way I know how to, at the moment. Regarding V8 beginners, there is some examples in v8/test/cctest/test-api.cc which could be helpful to learn how to do various things. For libuv there is [1]. People mention that reading the tests[2] helps to create a mental picture of how everything ties together. [1] http://nikhilm.github.com/uvbook/ [2] https://github.com/joyent/libuv/tree/master/test -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] How to properly pass LocalObject as function param?
Ok thanks for the help. I think through this code I'm writing I've at least nailed down when to use those two handle types. Thanks again! Ryan On Sunday, November 11, 2012 9:19:44 PM UTC-6, Ben Noordhuis wrote: On Mon, Nov 12, 2012 at 4:16 AM, Ryan Cole ry...@rycole.com javascript: wrote: Ok awesome, thanks for the reads. Also, just to deliberately ask, what about in async function calls? I'm assuming I'd not use LocalObject? For example, if I were using the baton pattern, would my baton struct use a LocalObject? I've seen examples for callback functions that use PersistentFunction, so that makes me think I'd use PersistentObject to cross those function calls? Yes, PersistentObject. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Returning Error from within C++ addon?
I'm writing an addon in C++ and would like to pass an Error to a callback function if an error occurs. I see how to throw exceptions, but in this case I simply want to pass an Error. I've looked through v8 docs and node.h but don't see any examples of returning an Error. I know this must be extremely simple but I'm just not seeing how to do it. Thanks. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Returning Error from within C++ addon?
Awesome, thanks. I had been looking for that all day, but didn't realize it was bundled there. Ryan On Saturday, November 10, 2012 2:53:34 PM UTC-6, Fedor Indutny wrote: Use Exception::Error(String::New(Error message)) to create error object. Cheers, Fedor. On Sun, Nov 11, 2012 at 12:19 AM, Ryan Cole ry...@rycole.comjavascript: wrote: I'm writing an addon in C++ and would like to pass an Error to a callback function if an error occurs. I see how to throw exceptions, but in this case I simply want to pass an Error. I've looked through v8 docs and node.h but don't see any examples of returning an Error. I know this must be extremely simple but I'm just not seeing how to do it. Thanks. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nod...@googlegroups.comjavascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Acceptable actions to take inside a C++ addon's initialization function?
I'm getting a seg fault core dump in a simple module. I can eliminate the seg fault if I comment out a ThrowException call in the initialization function. My code: https://gist.github.com/4053133 (line #28) Things makes me wonder, what are the acceptable actions to take inside of this initialize function? Is this seg fault occurring because I'm throwing an exception while loading the module? Obviously I need to figure out why the function call on line 27 is failing, so that I can avoid that error condition all together. How should I handle initialization failures, though? Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?
I'm writing a module that parses data as it comes in from a tcp socket. When reading out data from a Buffer, is it better to stick to the slice method because of the fact that it uses the same heap memory as the initial Buffer? Do the read methods do this, as well? I've just assumed that the read methods do not use that same Buffer memory. I'd think that if it were possible to stick to just using slice, my module would use less memory during this data parsing phase. Is this accurate? Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?
Yea, I meant the buf.readUInt32BE and friends. Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Examples of C++ modules, for Node.js
Roy, I notice you mentioned this early in the email chain. I should have tried it earlier. It fixes the issue. I wonder why the ldflags in binding.gyp does not properly set this up, in my case? Or, is LD_LIBRARY_PATH just another required step no matter what? Also, I did not know about the ldd command - very handy! Thanks, Ryan On Monday, April 23, 2012 3:29:38 AM UTC-5, rhasson wrote: I found out that I needed to set up my LD_LIBRARY_PATH env variable otherwise it will not find the path to the shared library. set it up like this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/hdf5/lib Then rebuild the project. Once rebuilt type: ldd build/Release/hdf5.node (or whatever your module name is) and see if your HDF5 shared library you trying to link to is listed. If not than it didn't link correctly. Roy -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Wrapping a C++ object, and adding properties directly onto args.This() = incorrect?
I'm wrapping a C++ object and then appending some properties. I'm calling Wrap(), and then Set()'ing the properties directly onto args.This(). This does not look or feel right to me, so I'm inclined to think I'm doing it wrong. I'm so new to this that none of the examples are standing out to me as the proper way of doing this. Can someone please take a peek at the highlighted lines of my code and give me a few pointers? Namely, am I doing this incorrectly? https://github.com/ryancole/node-hdf5/blob/master/src/node_h5file.cc#L67-74 Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Examples of C++ modules, for Node.js
Oh, wow. I did not have email notifications enabled for responses, so I did not expect to sign in and see so many helpful responses. Thank you for these. I'm going over them now and will apply this insight to what I'm doing. Also, per Nathan's suggestion, I think I will update from node 0.6.7 to 0.7, at least. I'll let you all know the outcome of this, soon. :) Thanks, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Examples of C++ modules, for Node.js
Is there no way to specify the library search path from within the binding.gyp file? I'm just trying to see if it's possible to make `node-gyp configure` spit `-L/usr/local/hdf5/lib` out into the Makefile, or whatever it builds. I'll be searching the docs, but I haven't run across it yet. I'll let you know if I find something. Ryan On Sunday, April 22, 2012 11:13:33 AM UTC-5, rhasson wrote: Just to add to Nathan's comments, you're missing a libraries that points to the the HDF5 shared library that was compiled separately. for example: 'libraries': ['/home/user/hdf5/lib/hdf5.so'] Also, I noticed that when compiling with node-gyp (which I love btw) you need to set LD_LIBRARY_PATH environment variable to the directory where the HDF5 shared library is located. for example: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/hdf5/lib after you do that, try building your project again. Roy On Saturday, April 21, 2012 9:50:49 PM UTC-4, Ryan Cole wrote: Hello, I'm learning how to write C++ modules, for Node.js. I'm sort of brute-forcing my learning by looking at examples, referencing the documentation for v8 and trial and error. The only two modules that I can seem to think of, as a reference, are hiredis-node and node.bcrypt.js. Both have helped me get to where I am now, which is able to compile a base skeleton module, using node-gyp. Are there any other modules that are written in C++ that would be simple + good to reference? For example, I'm currently trying to write a module that simply wraps and exposes a class from an existing third-party lib, HDF5. I've got it all written to the point where I think I am supposed to initialize an object of that class I want to expose, but when I include the code to initialize it, I cannot `require` it from within Node. It will compile, but I cannot require it. I do not think it is actually compiling properly. The HDF5 lib comes with a special wrapper binary around g++ that sets up the compile environment for you, so I guess I need to figure out how to tell node-gyp to use that. My code is here, if anyone wants to take a peek: https://github.com/ryancole/node-hdf5 Thanks -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Examples of C++ modules, for Node.js
I have adjusted the binding.gyp file to include the linker settings required for including the HDF5 libs I need. I believe that the current gyp file mirrors a Makefile that I am able to get working, for HDF5's stand alone compile. The only difference is that you're supposed to run the HDF5 Makefile with this custom binary, h5c++, that I think does some additional build configurations for you. I only see two options here, I think. One option would be to compile this node lib using that h5c++ binary. The other option would be to figure out what that h5c++ binary does, and reproduce it within the binding.gyp file. Currently, using this binding.gyp file, my node lib will compile and I assume it also links with hdf5 lib now. (https://github.com/ryancole/node-hdf5/blob/master/binding.gyp) I have updated to a node version 0.7+, and can see the error message when I try to require my node lib, now. It looks like this: ryan@ryan-server:~/repos/node-hdf5$ node require('./build/Release/hdf5') Error: libhdf5.so.7: cannot open shared object file: No such file or directory at Object..node (module.js:475:11) at Module.load (module.js:351:32) at Function._load (module.js:309:12) at Module.require (module.js:357:17) at require (module.js:373:17) at repl:1:2 at REPLServer.eval (repl.js:110:21) at Interface.anonymous (repl.js:249:12) at Interface.emit (events.js:87:17) at Interface._onLine (readline.js:178:10) That's with my .gyp file as-is. When I try to run this command, node-gyp build CXX=/path/to/h5c++, I get an error saying that I need to try again using the -fPIC parameter. No matter where I specify that parameter, it just seems to tell me to try again using -fPIC. I think I may be heading down the wrong path with that -fPIC, though. Anyway, just wanted to document my leaving-off-spot so that I can pick up with it tomorrow. Also, so that if anybody has any suggestions they could share them too! :) Thanks all, Ryan -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en