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


 >To: info-mcl@ministry.cambridge.apple.com
 >From: jmartin@kuhub.cc.ukans.edu
 >Newsgroups: comp.lang.lisp.mcl
 >Subject: ff-interface
 >Date: 6 May 93 15:31:57 CST
 >Organization: University of Kansas Academic Computing Services
 >I am trying to load MathLink (compiled C library) into the ff-interface of
 >MCL.  All of the C functions expect 2 parameters, an integer giving the length
 >of the second parameter, which is "an array of strings".  I cannot decipher
 >how to construct an an array of strings in LISP and then pass it to the C
 >function.  Does anybody have any idea what data types to use.  It seems that
 >C is expecting a pointer to the beginning of a contiguous set of strings, but
 >I don't know enough to construct this set in LISP, get a pointer to it and
 >then pass it to the C function.
I'll take a wild guess here, but maybe something like this would work.
In this example, you create an array of 3 strings to pass to MathLink:

(let ((null-string (string #\null)))
    (with-cstrs ((c-string-array (concatenate 'string
                                       "this is a string" null-string
                                       "another string" null-string
                                       "yet another string" null-string)))
      (your-mathlink-function 3 c-string-array)))