changeset 29237:1af06a145d40

Un-set API flags when using functions without linking to shared library (patch #8919). * src/main.in.cc, src/mkoctfile.in.cc: The gnulib wrapper functions are linked in statically. Un-define OCTAVE_API to use the correct functions instead of the (mangled) functions from the import library.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 29 Dec 2020 18:31:46 +0100
parents 9b1ccd094d1b
children cd6b616b36a8
files src/main.in.cc src/mkoctfile.in.cc
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.in.cc	Tue Dec 29 18:25:24 2020 +0100
+++ b/src/main.in.cc	Tue Dec 29 18:31:46 2020 +0100
@@ -43,6 +43,10 @@
 #include <iostream>
 #include <string>
 
+// We are linking against static libs so do not decorate with dllimport.
+// FIXME: This should be done by the build system.
+#undef OCTAVE_API
+#define OCTAVE_API
 #include "fcntl-wrappers.h"
 #include "signal-wrappers.h"
 #include "unistd-wrappers.h"
--- a/src/mkoctfile.in.cc	Tue Dec 29 18:25:24 2020 +0100
+++ b/src/mkoctfile.in.cc	Tue Dec 29 18:31:46 2020 +0100
@@ -60,6 +60,10 @@
 #    define OCTAVE_UNUSED
 #  endif
 #else
+// We are linking against static libs so do not decorate with dllimport.
+// FIXME: This should be done by the build system.
+#  undef OCTAVE_API
+#  define OCTAVE_API
 #  include "mkostemps-wrapper.h"
 #  include "uniconv-wrappers.h"
 #  include "unistd-wrappers.h"
@@ -158,10 +162,11 @@
 replace_prefix (std::string s)
 {
   const std::string match = "${prefix}";
+  const std::string repl = prepend_octave_exec_home ("");
   size_t pos = s.find (match);
   while (pos != std::string::npos )
     {
-      s.replace(pos, match.length (), prepend_octave_exec_home (""));
+      s.replace(pos, match.length (), repl);
       pos = s.find (match);
     }