Skip to content

Commit 0642652

Browse files
committed
address PR feedback
1 parent f76b323 commit 0642652

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

node.gyp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@
113113
'src/node_debug.cc',
114114
'src/node_dir.cc',
115115
'src/node_dotenv.cc',
116-
'src/node_env_var.cc',
117116
'src/node_embedding_api.cc',
117+
'src/node_embedding_api.h',
118+
'src/node_env_var.cc',
118119
'src/node_errors.cc',
119120
'src/node_external_reference.cc',
120121
'src/node_file.cc',

src/node_embedding_api.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
// C-based API.
1414
//
1515

16+
#include "node_embedding_api.h"
1617
#include "node.h"
1718

18-
extern "C" {
19-
#ifdef _WIN32
20-
__declspec(dllexport) int node_embedding_start(int argc, char** argv) {
21-
return node::Start(argc, argv);
22-
}
23-
#else
24-
int node_embedding_start(int argc, char** argv) {
25-
return node::Start(argc, argv);
26-
}
27-
#endif
19+
EXTERN_C_START
20+
21+
int32_t NAPI_CDECL node_embedding_main(int32_t argc, char* argv[]) {
22+
return node::Start(argc, argv);
2823
}
24+
25+
EXTERN_C_END

src/node_embedding_api.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@
1313
// C-based API.
1414
//
1515

16-
#include "node.h"
16+
#ifndef SRC_NODE_EMBEDDING_API_H_
17+
#define SRC_NODE_EMBEDDING_API_H_
1718

18-
#ifdef _WIN32
19-
int __cdecl node_embedding_start(int argc, char** argv);
20-
#else
21-
int node_embedding_start(int argc, char** argv);
22-
#endif
19+
#include "node_api.h"
2320

21+
#define NODE_EMBEDDING_VERSION 1
22+
23+
EXTERN_C_START
24+
25+
// Runs Node.js main function. It is the same as running Node.js from CLI.
26+
NAPI_EXTERN int32_t NAPI_CDECL node_embedding_main(int32_t argc, char* argv[]);
27+
28+
EXTERN_C_END
29+
30+
#endif // SRC_NODE_EMBEDDING_API_H_

0 commit comments

Comments
 (0)