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

Re: ffi to MCL



<---
| >Date: Thu, 19 Nov 92 17:24:03 EST
| >From: staley@carnap.srl.ford.com (Scott M. Staley)
| >To: bill@cambridge.apple.com
| >Subject: Re: ffi to MCL
| >
| >> From bill@cambridge.apple.com Thu Nov 19 13:35:20 1992
| >> Date: Thu, 19 Nov 1992 13:41:52 -0600
| >> To: staley@carnap.srl.ford.com (Scott M. Staley)
| >> From: bill@cambridge.apple.com (Bill St. Clair)
| >> Sender: bill@cambridge.apple.com (Unverified)
| >> Subject: Re: ffi to MCL
| >> Cc: bill@cambridge.apple.com
| >> Content-Length: 1178
| >> 
| >> >Bill.
| >> >
| >> >I posted a question to the info-mcl a while back and got no takers so 
| >> >I thought I would try you direct. I am looking to get a C compiler to
| >> >write c code to link with mcl. There is something in the MCL manual about
| >> >c compiler must generate mpw compatible .o files. What does that entail?
| >> >
| >> >Does it mean the mpw is the only C I can use the ffi with, or could 
| >> >Think C or others be used. What do you recommend to write C code for MCL.
| >> >
| >> >I have no desire to but a c compiler to write plain c. My only purpose is
| >> >to hook to MCL.
| >> 
| >> I have heard that Think Pascal is able to import Think C projects and
| >> write MPW compatible libraries, but I have never done it. I know of no
| >> other way to make Think C generate object files that MCL's FFI knows
| >> how to parse.
| >> 
| >> One other way to run Think C generated code from MCL is to create a
| >> code resource. Guillaume Cartier has written some code to simplify finding
| >> entry points in this code resource. His code is on the MCL 2.0 CD in
| >> the folder:
| >> 
| >>    MCL 2.0 CD:User Contributed Code:Think C Interface:
| >> 
| >> It is also available for anonymous FTP from cambridge.apple.com in the file:
| >> 
| >>   /pub/mcl2/contrib/Cartiers-Contribs-1.2.sea.hqx
| >> 
| >> 
| >
| >Bill.
| >
| >Thanks for the come back. Can you say what is the minimimum mpw C stuff I
| >should buy to do the above. Also I might mention that the C code I hope
| >to integrate is in ANSI C.
| 
| I know very little about developing C on the Macintosh. I used Think C
| two or three years ago to do a small project, and have used MPW a little
| bit to assemble MCL's kernel, but that is the extent of my experience.
| >From looking at the November, 1992 APDA catalog, I would guess that you would
| need to get the MPW C Bundle, which was listed for $425. The description of
| the MPW C compiler version 3.2.4 says "The MPW C compiler supports K&R C,
| as well as many ANSI extensions to C, including function prototypes and strong type checking. It includes a standard C library that offers the functions
| described in the ANSI C standard." I do not know if "many ANSI extensions"
| means that it will have problems with your "ANSI C", nor do I know if
| Think C is closer to the ANSI standard (or if that will matter for your
| code), or how the effort involved in building Think C stubs using Guillaume
| Cartier's package compares to writing DEFFCFUN stubs to interface to MPW C.
| 
| Can someone else help out?
--->

My Think C interface was originaly created so I could write the floating
point routines of my 3D viewing package in C (MCL's compiler doesn't
recognize floating point declarations and so generates inneficient code
relative to both speed and memory allocation) (note that this is not a
problem anymore since we now have Erann Gat's wonderful FPC package).

With that in mind, my interface was thought out for fast development
(changing your C code, compiling the resource, testing it in MCL, etc...).

On the other hand, using it to interface a big package of C code already
writen is more complex. The biggest problem is that my interface doesn't
understand everything type a C routine can pass or be passed. For instance,
if you want to pass a structure via a pointer, no problem; but if you
want to pass the structure itself... that is not done.

Hope this clarifies things a bit,
Guillaume.

PS: If you have more specific question about my Think C interface,
    write to me directly and I will try to help.

*********************************************************************
* Guillaume Cartier                 (514) 844-5294 (maison)         *
* L.A.C.I.M.                        (514) 987-4290 (bureau)         *
* Universite du Quebec a Montreal   (514) 987-8477 (telecopieur)    *
* Montreal, Quebec, Canada          cartier@math.uqam.ca (internet) *
*********************************************************************