From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thiago de Arruda <tpadilha84@gmail.com>
Date: Mon, 6 Mar 2017 10:42:34 -0300
Subject: Expose `get_linked_module` function

This is a requirement for electron/electron#8815, which exposes some linked
modules to sandboxed renderers.

TODO(codebytere): remove and replace with a public facing API.

diff --git a/src/node_binding.cc b/src/node_binding.cc
index 0b5f6cfa038369be758e3b0857ee6fa594358b58..5291858bb164a262ca1d69d2582e037aeab23d55 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -605,6 +605,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
   args.GetReturnValue().Set(exports);
 }
 
+node_module* get_linked_module(const char* name) {
+  return FindModule(modlist_linked, name, NM_F_LINKED);
+}
+
 void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
   Environment* env = Environment::GetCurrent(args);
 
diff --git a/src/node_binding.h b/src/node_binding.h
index 5bced5b41431dc7838d1a30774a1a41ff797290e..4233ee968fb4b3b5456997cbf1450ecf07392455 100644
--- a/src/node_binding.h
+++ b/src/node_binding.h
@@ -91,6 +91,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
 void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
 void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);
 
+NODE_EXTERN node_module* get_linked_module(const char *name);
+
 }  // namespace binding
 
 }  // namespace node
