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

ff-load problems and records



I'm having more problems with ff-load and have some questions regarding
records and structures especially when used with foreign functions.

First, before applying the three patches to MCL 2.0b1, I could not
successfully load version (3) object files, which corresponded to
those having SADE type symbols in them.  Now I can load them, but I
still get a warning error and have to continue explicitly.  Is this a
sign that I have still not done the patching correctly?  I did
(REINDEX-INTERFACES), but I presume that is independent of the
save-application.  

Compiling without symbols avoids this warning problem all together,
and besides there isnt much point in having the symbols because there
appears to be no way to debug such code - SADE cannot step through
your code for example.  (I'd like to hear if anyone has a way to debug
ff code, or compiled code for that matter.)  However, it would be
easier to leave the symbols in the object code since we also need to use
the same code outside of Lisp, to debug it for one thing.

I get several duplicate entry points that it would be nice to resolve,
but I dont think they are significant or harmful, just mysterious.
There is no clue given where the duplicates are coming from.  I dont get
the errors when I link the library in MPW C programs.

Even compiling without symbols (and without 68881 use), when I call my
ff, MCL crashes with a system error of type 16 which is some floating
point problem I believe.  I dont get this error when I call the
function from C code.  What could be going wrong?  I recompiled *with*
68881 use and I get a type 16 error, followed by a type 11 error and
a type 2 error.  Is MCL loading floating point code incorrectly?

I havent gotten a conclusive answer on the issue of calling code
compiled to use the 68881.  The MCL documentation says that if the
68881 or 68882 is available, all floating-point computations use it.
Does that include foreign function code?  If so, one should be
required to compile with the 68881 flag on.  If not, it would be nice
to specify a single keyword flag on the ff-load to indicate whether
68881 is used in the code, and argument passing would act accordingly,
so one doesnt have to duplicate all the deffcfun declarations that
pass floating point arguments.  Actually, there doesnt seem to be any
argument type option for the 96-bit format.

There is nothing stated in the documentation regarding what foreign
functions may do to the environment.  I discovered that it is not wise
to have them open windows, since Lisp doesnt know how to relate to them.
But what else is bad?  How about mallocing their own space?  How about
file io?  

Finally, MCL provides records which are a great convenience, and in
fact necessary for communication with the mac toolbox.  However, there
appears to be no way to put floating point values in records.  I could
define a field as an array of bytes, but I see no way to essentially
cast the value in a field as if it were some other lisp type.  (I'm
not talking about the coerce function which converts values into other
types.)

Is there a way to convert between records and structures?  I can pass
structures to foreign functions, as a lisp-ref, but how do I know what
the internal structure of a structure is?  Since I can pass lisp-refs
to foreign functions, it would also be handy to return them.

I was planning on passing arrays of floats to my ff library (to do GL
style 3D graphics), but I am not making much progress.  Any help
is appreciated.

Thanks
Dan LaLiberte
National Center for Supercomputing Applications

liberte@ncsa.uiuc.edu
(Join the League for Programming Freedom: league@prep.ai.mit.edu)