The upshot is that the current expression which establishes the libc pointer is now the following.
Code: Select all
(define LIBC (case ostype
("Win32" "msvcrt.dll")
("OSX" "libc.dylib")
("Linux" (if is64bit
"/lib/x86_64-linux-gnu/libc.so.6"
"/lib/i386-linux-gnu/libc.so.6"))
))
So, here are two methods I found which seem more robust than the current method. I wonder if you Linux gearheads here would scrutinize these.
One method is to ask gcc where libc is located. This method is discussed here: http://stackoverflow.com/questions/9705 ... er#9706172. Here it is implemented.
Code: Select all
(define LIBC
(case ostype
("Win32" "msvcrt.dll")
("OSX" "libc.dylib")
("Linux"
(letn (libc-name (first (exec "gcc -print-file-name=libc.so"))
libc-filetype (first (exec (string "file -b " libc-name))))
(if (find "ASCII" libc-filetype)
(first (regex "[^ \t]+/libc\\.so\\.*[0-9]*" (read-file libc-name)))
libc-name)))
))
Code: Select all
(define LIBC
(case ostype
("Win32" "msvcrt.dll")
("OSX" "libc.dylib")
("Linux"
(nth 2
(parse
(first
(filter (curry find "libc.so")
(if (ends-with (real-path) "qa-specific-tests")
(exec "ldd ../newlisp")
(exec "ldd ./newlisp")))))))
))