From: Martin Mallinson

Subject: New to Franz LISP: a couple of questions

Date: 1997-5-29 4:32

Hi there,

I am just trying out Franz LISP and wonder if anyone
out there can give a little advice (this may be
trivial - bear with me while I get up to speed).

I am trying to use the FFI: I have opened the DLL and
called an example function like this and it seems 
to work... (our IC test machine is driven from a
Borland C environment via these DLL functions - I
am trying to hook LISP into it)

;; Test the interface to the CMT machine...

(defvar *cmt-library* "c:\\windows\\cmtpts32.dll")

(ct:defun-dll dll-version ((x (:char *)))
 :return-type :void
 :library-name *cmt-library*
 :entry-name "CMT_DLL_VERSION")

(defun get-dll ()
   (let ((string (ct::callocate (ct::char 256))))
      (dll-version string)
      (subseq string 0 (ct:strlen string))))

this returns "V1.09D" as it should, so I guess am on the 
right track....

I have two questions:

1) How do I get back a double? The C header file is this:

double PTSAPI CMT_PSU_VOLTq (int chan_num);

(-- PTSAPI is one of our macros -- )

so naturally I want to write:

(ct:defun-dll volt? ((x :long))
 :return-type :double-float
 :library-name *cmt-library*
 :entry-name "CMT_PSU_VOLTq")

but compiler says it cant return a double(?) Surely there is a way...

2) How do I write the ct:defun-dll to this DDL entry?
   and how do I call it? I hacked about a bit and managed
   to blow out of lisp every time.....
      
void PTSAPI CMT_INIT (HINSTANCE hInstance, HINSTANCE hPrevInstance,
		      LPSTR lpszCmdParam, int nCmdShow, LPCSTR DeviceName);

This is the function that is called when the Borland main function starts...

Anyhow, any help much appreciated.

PS:  We are also looking at AllegroStore (reading the documentation
     tells me this a cool product and we can use it in our company)
     Does anyone out there use it on the PC? All the documentation
     seems to be aimed at a UNIX user. Although I am a hacker at heart
     I hate to be first-into-the-future on what could turn out to be
     a massive time-sink. Any informal comments appreciated.

---------------------------------------------------
Name: Martin Mallinson
E-mail: <cmt.com at martin.mallinson> (Martin Mallinson)
Date: 5/28/97
Time: 10:33:13 PM
---------------------------------------------------