Skip to content
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

Support msvc compiler (be able to produce Node.js native addons) #12009

Closed
anurbol opened this issue Aug 23, 2019 · 6 comments
Closed

Support msvc compiler (be able to produce Node.js native addons) #12009

anurbol opened this issue Aug 23, 2019 · 6 comments

Comments

@anurbol
Copy link

anurbol commented Aug 23, 2019

Summary

Generated c/c++ code should not contain GCC-specific stuff (e.g. attribute).

Description

I wanted to write a node addon in Nim, but unfortunately without success. I managed to do everything needed (getting generated .cpp files from nimcache folder, exporting nim symbols with .exportc.), but failed at the last stage.
Turns out that Node addons binaries (Windows ones) are built exclusively by msvc (via node-gyp), and the compiler does not understand Nim-generated c/c++ code, since the code is GCC specific. To be more specific, Nim generates __attribute__ things that's OK for GCC, but not for msvc, and msvc produces c3646 unknown override specifier errors.

Alternatives

Well, I have to stick with c++ for now (I wanted to switch to Nim so badly)

@nc-x
Copy link
Contributor

nc-x commented Aug 23, 2019

Use --cc:vcc for MSVC compiler. See https://nim-lang.org/docs/nimc.html#compiler-selection and https://nim-lang.org/faq.html (How do I use a different C compiler than the default one?).

@anurbol
Copy link
Author

anurbol commented Aug 23, 2019

@nc-x Lol what 😄 Oh my God, I almost learned the contents of nim --fullhelp by heart (there is no --cc option, unless I am blind), when I just should have looked at FAQ? LOL. Thanks!!! I'll try that!

@nc-x
Copy link
Contributor

nc-x commented Aug 23, 2019

Yeah, i just checked, it is not there in --help or --fullhelp.

@anurbol
Copy link
Author

anurbol commented Aug 23, 2019

Yeah, i just checked, it is not there in --help or --fullhelp.

That's a material for another issue 😃

@anurbol
Copy link
Author

anurbol commented Aug 23, 2019

Seems to work perfectly... Are Nim creators even Humans? I mean everything seems so good... I'll close this for now, but will reopen if something pops out.

@anurbol anurbol closed this as completed Aug 23, 2019
@ohenepee
Copy link

@anurbol Did it work (I mean making the nodejs native addon thingy)? Any repo or tuts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants