about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2019-07-02T23·46+0200
committerNiklas Hambüchen <mail@nh2.me>2019-07-03T02·32+0200
commitd203c554faa00fec55377d6640c8fb335a611a09 (patch)
tree027ee0c3829aceffccb035af78230216708cf870 /src/nix
parentb49c3a9db516a87d38476966eff9994c13c5acf6 (diff)
Fix C++ compatibility with older editline versions.
For example, Ubuntu 16.04 and many similar long-term-support distros
have older versions.
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/repl.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index d8f812149069..f857b2e89c29 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -9,7 +9,14 @@
 #include <readline/history.h>
 #include <readline/readline.h>
 #else
+// editline < 1.15.2 don't wrap their API for C++ usage
+// (added in https://github.com/troglobit/editline/commit/91398ceb3427b730995357e9d120539fb9bb7461).
+// This results in linker errors due to to name-mangling of editline C symbols.
+// For compatibility with these versions, we wrap the API here
+// (wrapping multiple times on newer versions is no problem).
+extern "C" {
 #include <editline.h>
+}
 #endif
 
 #include "shared.hh"