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

cstring argument in deffcfun


I am trying to pass a cstring in this argument,unable to pass
correct arguments.. the c environment is expecting a string as its argument, and
will return a long integer:

(deffcfun (ml-open-s "MYcstring") ("mycstring" :cstring) :long); unsuccessful

I alos have a dialog box which allows the user to launch a process, but though I have been able to open the resource and receive a null poonter to it as well as get the resource reference number, I am unsure how to launch the "dlog" box:

(defun get-resource (rsrc-type rsrc-id-or-name &key (errorp t))
   (let ((rsrc_h (etypecase rsrc-id-or-name
                   (fixnum (#_GetResource rsrc-type rsrc-id-or-name))
                   (string (with-pstrs ((name_p rsrc-id-or-name))
                             (#_GetNamedResource rsrc-type name_p))))))
     (when (and errorp (%null-ptr-p rsrc_h))
       (error "Failed to load resource ~s of type ~s (ResError = ~a)."
              rsrc-id-or-name rsrc-type (#_ResError)))

(get-resource "DITL" 1132 :errorp nil)

(defun open-res-file (pathname &key (if-does-not-exist :error) (if-no-rsrc-fork :error))
;;Opens the resource fork of the the specified file and returns the refNum
  (with-pstrs ((fn (mac-namestring pathname)))
    (unless (probe-file pathname)
      (when if-does-not-exist
        (ecase if-does-not-exist
          (:create (#_CreateResFile fn) (open-res-file pathname))
          (:error (error "~s does not exist" pathname)))))
    (let ((refNum (#_OpenResFile fn)))
      (if (plusp refNum)
        (when if-no-rsrc-fork
          (ecase if-no-rsrc-fork
            (:create (#_CreateResFile fn) (open-res-file pathname))
            (:error (error "~s has no resource fork" pathname))))))))

(open-res-file "ccl:examples;FF examples;mydialogbox.rsrc")

These last two functions aare part of oodles of utils distribution, which I have adapted for my needs.thanks to NMU.

Any help willbe appreciated

Thank you

CLint LeFort