Skip to content

Commit 82dddfa

Browse files
author
John French
committed
Document adding -fvisibility=hidden flag for macOS users
* -fvisibility=hidden flag for macOS user Added section to remember the macOS user to add the `-fvisibility=hidden` flag. PR-URL: nodejs/node-addon-api#460 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent cc34d49 commit 82dddfa

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

doc/setup.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,19 @@ To use **N-API** in a native module:
5555
```gyp
5656
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
5757
```
58-
59-
4. Include `napi.h` in the native module code.
58+
4. If you would like your native addon to support OSX, please also add the
59+
following settings in the `binding.gyp` file:
60+
61+
```gyp
62+
['OS=="mac"', {
63+
'cflags+': ['-fvisibility=hidden'],
64+
'xcode_settings': {
65+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
66+
}
67+
}]
68+
```
69+
70+
5. Include `napi.h` in the native module code.
6071
To ensure only ABI-stable APIs are used, DO NOT include
6172
`node.h`, `nan.h`, or `v8.h`.
6273

0 commit comments

Comments
 (0)