newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: linli on November 09, 2009, 12:14:23 AM

Title: A bug on Windows
Post by: linli on November 09, 2009, 12:14:23 AM
I had the following problem:

> (change-dir "h:")
true
> (real-path)
"H:\"
> (change-dir "c:\a\b")
true
> (real-path)
"c:\a\b"
> (change-dir "h:")
true
> (real-path)
"H:\"
> (change-dir "c:")
true
> (real-path)
"c:\a\b"

In the last step, I was trying to change the dir to c:, but it remains in c:ab
Title: Re: A bug on Windows
Post by: Lutz on November 09, 2009, 04:23:47 AM
With C: without the slash, you only change the drive and to the directory which was current on C: before. If you want to change to root of C: do "C:\" or "C:/". This is standard MS Windows behavior.
Title: Re: A bug on Windows
Post by: bjo on November 21, 2009, 04:03:02 AM
On Windows (Vista) the (file?) built-in does not seem to look in any or all PATHs:



> (file? "libgmp-3.dll")
nil
> (import "libgmp-3.dll" "__gmpz_mul")
__gmpz_mul <1000D880>
Title: Re: A bug on Windows
Post by: cormullion on November 21, 2009, 06:12:05 AM
The manual suggests that import uses search paths: "If the library is not located in the normal library search path, str-lib-name must contain the full path name." but that file? just checks for file/directory existence.
Title: Re: A bug on Windows
Post by: bjo on November 22, 2009, 12:46:54 AM
The problem is that the gmp module depends on (import)'s behaviour when using (file?) to determine which file to use:



(set 'files '(
    "/usr/lib/libgmp.dylib" ; Mac OSX
    [...]
    "libgmp-3.dll" ; Win32 in Path))

(set 'library (files (or
  (find true (map file? files))
    (begin (println "cannot find GMP library") (exit)))))


On windows this piece of code will always fail.
Title: Re: A bug on Windows
Post by: Lutz on November 22, 2009, 04:50:01 AM
'file?' must have the full path-name specified. At least on Windows XP libgmp-3.dll is not installed by default and because of this, the full path-name has not been specified for libgmp-3.dll in the source of the gmp.lsp module.



You can either put libgmp-3.dll into the current directory to make the 'file?' statement in the module work on it, or you can change the path in the module to whatever location the DLL is installed on your machine.



A sentence has been added to the documentation clarifying this:



http://www.newlisp.org/code/modules/gmp.lsp.html





ps: welcome to newLISP