-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Nodejs to work on standalone C++ application on Windows #1087
Comments
Yes, Calling |
thanks for the reply. I assume by duplicating the logic you mean to do what the PlatformInit does right now, somewhere in my own source code. But do I have access to all the variables and defined objects that PlatformInit uses? I don't have my windows laptop nearby right now, but will give it a shot soon |
You don't need anything specific. The logic is this: https://github.com/nodejs/node/blob/v9.5.0/src/node.cc#L4422-L4434 |
I've tested that today and it worked. I did what bnoordhuis has suggested, duplicating the logic that PlatformInit does in my code and avoid touching the nodejs source code. |
ehsanen, could you please explain in more detail (hopefully with code example) how did you embed node.js without modifying node's source code? And how are you using it exactly (use the node loop?) |
@DiegoBM I have detailed in this issue (nodejs/node#23265 (comment)) how I have solved the problem of NodeJS embedding with examples and a working implementation. |
Thank you @viferga I finally solved my problem with a different solution, but if I consider integrating node.js again I'll consider your implementation |
We have embedded nodejs into our C++ crossplatform app. We faced a crash bug, which was cause by the lack of stdin when you do not run the node from command line. We noticed that there is already a pull request #11863 for this issue and we have these changes in our nodejs code. But this does not solve our problem as the
PlatformInit()
function in node.cc never gets called. Here is how we initialise node and v8 in our program:copied directly from
SetUp()
function innode_test_fixture.h
.interestingly we just face this problem on Windows not on macOs. We solved it now by adding this line
to
node.h
file in the node namespace, and then callingPlatformInit()
before creating the NodePlatform. So now our initialisation looks like this:Now we are wondering is our initialisation wrong at first place or is this really a bug and we need to create a pull request for it. Please advice.
The text was updated successfully, but these errors were encountered: