Lisp HUG Maillist Archive

lww pathname strangeness

I am calling a C dll from lispworks (lww 5.1) and it keeps failing because 
_getcwd() returns the wrong pathname.

I've tracked this down to (change-directory ...).  As soon as I use it, C's 
_getcwd returns a string with "\\?\" prepended to it (looks like a 
hostname!).

Does anybody know how to stop this from happening?  (Is this a bug or a 
feature?)


Here is a test that shows the problem (once per lisp session) on my W2K box:


(fli:define-foreign-function (getcwd "_getcwd" :source)
    ((buff (:pointer (:unsigned :char)))
     (len :int))
  :result-type (:pointer (:unsigned :char))
  :language :ansi-c
  :calling-convention :cdecl)

(defun test ()
  (format t "~A~%" (fli:convert-from-foreign-string
                    (getcwd
                     (fli:convert-to-foreign-string (make-string 
256 :initial-element #\*)
                                                    :null-terminated-p 
t :external-format :ascii)
                     256)))
  (change-directory (current-pathname))
  (format t "~A~%"(fli:convert-from-foreign-string
                   (getcwd
                    (fli:convert-to-foreign-string (make-string 
256 :initial-element #\@)
                                                   :null-terminated-p 
t :external-format :ascii)
                    256))))


Thanks
pt


Re: lww pathname strangeness

That character sequence is the standard NTFS volume naming convention:
http://blogs.msdn.com/adioltean/archive/2005/04/16/408947.aspx
"\\?\" Is the volume manager namespace and other identifiers are appended to it.
There's some advice in the "Translations" section about half way down
that article.
Sorry, that probably doesn't help much.

Cheers,
Chris

On Wed, Jun 4, 2008 at 3:47 PM, Paul Tarvydas
<tarvydas@visualframeworksinc.com> wrote:
>
> I am calling a C dll from lispworks (lww 5.1) and it keeps failing because
> _getcwd() returns the wrong pathname.
>
> I've tracked this down to (change-directory ...).  As soon as I use it, C's
> _getcwd returns a string with "\\?\" prepended to it (looks like a
> hostname!).
>
> Does anybody know how to stop this from happening?  (Is this a bug or a
> feature?)
>
>
> Here is a test that shows the problem (once per lisp session) on my W2K box:
>
>
> (fli:define-foreign-function (getcwd "_getcwd" :source)
>    ((buff (:pointer (:unsigned :char)))
>     (len :int))
>  :result-type (:pointer (:unsigned :char))
>  :language :ansi-c
>  :calling-convention :cdecl)
>
> (defun test ()
>  (format t "~A~%" (fli:convert-from-foreign-string
>                    (getcwd
>                     (fli:convert-to-foreign-string (make-string
> 256 :initial-element #\*)
>                                                    :null-terminated-p
> t :external-format :ascii)
>                     256)))
>  (change-directory (current-pathname))
>  (format t "~A~%"(fli:convert-from-foreign-string
>                   (getcwd
>                    (fli:convert-to-foreign-string (make-string
> 256 :initial-element #\@)
>                                                   :null-terminated-p
> t :external-format :ascii)
>                    256))))
>
>
> Thanks
> pt
>
>


Updated at: 2020-12-10 08:43 UTC