aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-22 13:19:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-22 13:19:42 +0200
commitbed4a6152b8d2c2b3a1f5636a4c6a3848a24080a (patch)
treee83ccb81cd3531aa30cc96e1c85bf985ee8b7217 /libbuild2
parentcee00343d0c537a31281b4de74fadd7589d434b0 (diff)
Add load_builtin_module()
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/module.cxx7
-rw-r--r--libbuild2/module.hxx8
2 files changed, 15 insertions, 0 deletions
diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx
index 1bd60a6..c3e4c62 100644
--- a/libbuild2/module.cxx
+++ b/libbuild2/module.cxx
@@ -33,6 +33,13 @@ namespace build2
{
loaded_module_map loaded_modules;
+ void
+ load_builtin_module (module_load_function* lf)
+ {
+ for (const module_functions* i (lf ()); i->name != nullptr; ++i)
+ loaded_modules[i->name] = i;
+ }
+
// Sorted array of bundled modules (excluding core modules bundled with
// libbuild2; see below).
//
diff --git a/libbuild2/module.hxx b/libbuild2/module.hxx
index f583361..3aaa1c7 100644
--- a/libbuild2/module.hxx
+++ b/libbuild2/module.hxx
@@ -154,6 +154,14 @@ namespace build2
//
using loaded_module_map = std::map<string, const module_functions*>;
LIBBUILD2_SYMEXPORT extern loaded_module_map loaded_modules;
+
+ // Load a builtin module (i.e., a module linked as a static/shared library
+ // or that is part of the build system driver).
+ //
+ // Note: assumes serial execution.
+ //
+ LIBBUILD2_SYMEXPORT void
+ load_builtin_module (module_load_function*);
}
#endif // LIBBUILD2_MODULE_HXX