Page 1 of 1
A bug on Windows
Posted: Mon Nov 09, 2009 8:14 am
by linli
I had the following problem:
Code: Select all
> (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:\a\b
Re: A bug on Windows
Posted: Mon Nov 09, 2009 12:23 pm
by Lutz
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.
Re: A bug on Windows
Posted: Sat Nov 21, 2009 12:03 pm
by bjo
On Windows (Vista) the (file?) built-in does not seem to look in any or all PATHs:
Code: Select all
> (file? "libgmp-3.dll")
nil
> (import "libgmp-3.dll" "__gmpz_mul")
__gmpz_mul <1000D880>
Re: A bug on Windows
Posted: Sat Nov 21, 2009 2:12 pm
by cormullion
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.
Re: A bug on Windows
Posted: Sun Nov 22, 2009 8:46 am
by bjo
The problem is that the gmp module depends on (import)'s behaviour when using (file?) to determine which file to use:
Code: Select all
(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.
Re: A bug on Windows
Posted: Sun Nov 22, 2009 12:50 pm
by Lutz
'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