On Wednesday, June 20, 2012 4:46:25 PM UTC+2, wtfux wrote:
>
> I wrote a GUI for my application as a c++ addon. Now I want node to start
> without the console. To do this I changed the subsystem from console to
> windows and replaced the following in node_main.cc (latest stable):
>
> int wmain(int argc, wchar_t *wargv[]) {
>
> with
>
> int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine,
> int nCmdShow) {
> int argc = __argc;
> wchar_t **wargv = __wargv;
>
>
> It works, Node starts without console and you can run your script. Only
> you can't use console output unless you pipe it to some file or something
> else.
> However after doing this my addon broke. Node will still load my addon and
> I can spawn a windows form and do stuff. However if I use uv or v8 stuff
> it'll crash because of an access violation at `mod->register_func(target);`
> in node.cc. Even a single `HandleScope scope` in the init function is
> enough to cause a crash.
> The same addon works when I run it with node with console. Both node
> executables are built from the same source, just with/without the patch
> above.
>
> I wonder how the access violation is related to changing node to a windows
> application? Any windows developer here who has a clue? Built-in stuff like
> a HTTP Server works without a crash. Loading modules works too, they just
> mustn't contain any v8/uv stuff. I can't figure this out...
>
You should also make sure that your addon links to the same version of the
CRT as node. Node statically links the crt with /MT.
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en