Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
'src/node_dir.cc',
'src/node_dotenv.cc',
'src/node_env_var.cc',
'src/node_embedding_api.cc',
'src/node_embedding_api.h',
'src/node_errors.cc',
'src/node_external_reference.cc',
'src/node_file.cc',
Expand Down
26 changes: 26 additions & 0 deletions src/node_embedding_api.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Description: C-based API for embedding Node.js.
//
// !!! WARNING !!! WARNING !!! WARNING !!!
// This is a new API and is subject to change.
// While it is C-based, it is not ABI safe yet.
// Consider all functions and data structures as experimental.
// !!! WARNING !!! WARNING !!! WARNING !!!
//
// This file contains the C-based API for embedding Node.js in a host
// application. The API is designed to be used by applications that want to
// embed Node.js as a shared library (.so or .dll) and can interop with
// C-based API.
//


#include "node_embedding_api.h"
#include "node.h"

EXTERN_C_START

int32_t NAPI_CDECL node_embedding_main(int32_t argc, char* argv[]) {
return node::Start(argc, argv);
}

EXTERN_C_END
30 changes: 30 additions & 0 deletions src/node_embedding_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Description: C-based API for embedding Node.js.
//
// !!! WARNING !!! WARNING !!! WARNING !!!
// This is a new API and is subject to change.
// While it is C-based, it is not ABI safe yet.
// Consider all functions and data structures as experimental.
// !!! WARNING !!! WARNING !!! WARNING !!!
//
// This file contains the C-based API for embedding Node.js in a host
// application. The API is designed to be used by applications that want to
// embed Node.js as a shared library (.so or .dll) and can interop with
// C-based API.
//

#ifndef SRC_NODE_EMBEDDING_API_H_
#define SRC_NODE_EMBEDDING_API_H_

#include "node_api.h"

#define NODE_EMBEDDING_VERSION 1

EXTERN_C_START

// Runs Node.js main function. It is the same as running Node.js from CLI.
NAPI_EXTERN int32_t NAPI_CDECL node_embedding_main(int32_t argc, char* argv[]);

EXTERN_C_END

#endif // SRC_NODE_EMBEDDING_API_H_
Loading