guile-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile and readline on MacOS X


From: Aurelien Chanudet
Subject: Guile and readline on MacOS X
Date: Mon, 6 Jan 2003 18:34:14 +0100

Hi all and happy new year !

A few days ago, I posted to address@hidden to report about a small modification I had to do in order to compile guile 1.4.1 on MacOS X 10.2 with readline support. Without this modification, linking fails with an undefined symbol error. Thien-Thi Nguyen suggested I should post the patch here (see below). I don't know in depth about the shared library mechanism (.dylib versus .so) on MacOS X but I suspect there is another solution. I also had to modify guile-readline/readline.scm in order to supply a different path for libguilereadline (see below as well).

Best,
Aurelien

--- ../archives/guile-1.4.1/guile-readline/readline.c Thu Jan 3 12:05:00 2002
+++ guile-readline/readline.c   Mon Jan  6 18:06:39 2003
@@ -41,6 +41,16 @@
 #include "libguile/validate.h"
 #include "guile-readline/readline.h"

+#ifdef __APPLE__
+#include <crt_externs.h>
+/*
+ * On MacOS X, extern char** environ is in crt1.o which cannot be
+ * linked into any dynamiclib as requested by -twolevel_namespace.
+ * One should use NSGetEnviron() to set it.
+ */
+char **environ;
+#endif
+
 scm_option scm_readline_opts[] = {
   { SCM_OPTION_BOOLEAN, "history-file", 1,
     "Use history file." },
@@ -528,6 +538,10 @@
 void
 scm_init_readline ()
 {
+#ifdef __APPLE__
+  environ = *_NSGetEnviron();
+#endif
+
 #ifdef HAVE_RL_GETC_FUNCTION
 #include "guile-readline/readline.x"
   scm_readline_completion_function_var


--- readline.scm.old    Mon Jan  6 18:32:09 2003
+++ readline.scm        Sun Dec 29 11:04:37 2002
@@ -30,7 +30,7 @@
 ;;; but only when it isn't already present.

 (if (not (feature? 'readline))
- (dynamic-call "scm_init_readline" (dynamic-link "libguilereadline.so"))) + (dynamic-call "scm_init_readline" (dynamic-link "/usr/local/lib/libguilereadline")))

 (if (not (feature? 'readline))
     (scm-error 'misc-error





reply via email to

[Prev in Thread] Current Thread [Next in Thread]