Am Mittwoch, 05.03.03 um 17:46 Uhr schrieb rif:

> ps.  This example is taken from section 8.7.5 of the CMUCL manual.  As
> far as I can tell, this example was never tested, as there are at least
> three errors:
>
> 1.  The definition of sum is wrong --- it's declared to return a
>     double and returns nothing.
>
> 2.  The def-alien-routine call is wrong.  It says (n int :in) but I'm
>     pretty sure means (n integer :in).

Actually, it probably means int, i.e. c-call:int.  The alien facility 
defines "generic" alien types, which aren't (in theory) bound to the 
way C compilers define their types on the platform in question.  This 
is because, again in theory (and for e.g. Fortran in practice, too, I 
gather), the alien facility is intended to allow you to interface to 
other languages besides C.

In addition to the alien facility, there is the c-call package, which 
defines specialized alien types which should correspond to the platform 
C compiler's idea of its types, e.g. stuff like c-call:int, 
c-call:unsigned-int, c-call:short, etc.

It also contains the alien type c-string, which allows automagic 
passing and receiving of lisp strings to/from C functions that take C 
strings, i.e. char*.

I haven't looked at the example in question, so maybe it has some 
problems with not using c-call (:use clause, use-package, whatever), 
but otherwise the int should be fine.

> Does anyone agree/disagree that this example is of pretty low quality,
> and should probably be fixed up?

Some of the samples in the alien sections have bit-rotted a bit, I 
think, and we might want to replace them.  Better examples are 
certainly welcome!

Regs, Pierre.

-- 
Pierre R. Mai <[EMAIL PROTECTED]>                    http://www.pmsf.de/pmai/
  The most likely way for the world to be destroyed, most experts agree,
  is by accident. That's where we come in; we're computer professionals.
  We cause accidents.                           -- Nathaniel Borenstein


Reply via email to