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

Enabling C++ exceptions on Windows is hell #1379

Closed
mmomtchev opened this issue Sep 14, 2023 · 2 comments · Fixed by #1389
Closed

Enabling C++ exceptions on Windows is hell #1379

mmomtchev opened this issue Sep 14, 2023 · 2 comments · Fixed by #1389

Comments

@mmomtchev
Copy link

(this is the suite of nodejs/node-gyp#2903)

node-addon-api seems to include an undocumented but very useful file found node_modules\node-addon-api\except.gypi.

Alas, besides being undocumented, this file is very hard to use, since when a module is installed in production, its path will be different and gyp does not support variable expansion in includes directives.

mmomtchev added a commit to mmomtchev/magickwand.js that referenced this issue Sep 14, 2023
mmomtchev added a commit to mmomtchev/magickwand.js that referenced this issue Sep 14, 2023
@mhdawson
Copy link
Member

After discussion in the node-addon-api team meeting today @legendecas is going to take a look at the issue in a bit more depth.

@legendecas legendecas mentioned this issue Oct 9, 2023
2 tasks
@legendecas
Copy link
Member

Tried with node-gyp -I option and automatic config.gypi detection, not working with no luck. However, I found that we can sort of solve the problem with a dummy gyp dependency. As documented at https://gyp.gsrc.io/docs/InputFormatReference.md#processing-order, a dependency's setting is processed after merging the root target_defaults, and variable expansion is allowed in dependency specifiers.

This allows the following pattern to enable c++ exception support:

'dependencies': [
  "<!(node -p \"require('node-addon-api').gyp\"):node-addon-api-except"
]

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

Successfully merging a pull request may close this issue.

3 participants