FFI Question

Stephen Pair spair at advantive.com
Thu May 17 15:07:27 UTC 2001


Ok, thanks for the tips...I specifically wanted to avoid hacking things.  I
didn't know if the people that worked on FFI had envisioned a particular way
for this to be handled or not.  The benefit to using typedefs is that you
have a single place to make a change if the API changes the base type for a
typedef.  It also allows the cdecls to more closely mirror the original
signatures.

If it's not there now, I'll just avoid the issue (already have more work
than I can handle right now).

- Stephen

> -----Original Message-----
> From: Bert Freudenberg [mailto:bert at isg.cs.uni-magdeburg.de]
> Sent: Thursday, May 17, 2001 10:29 AM
> To: Stephen Pair
> Cc: Squeak
> Subject: Re: FFI Question
>
>
> On Thu, 17 May 2001, Stephen Pair wrote:
>
> > With the latest FFI code, what is considered the best way to handle
> > simple C typdefs such that you can use them in the "cdecl" pragmas?
> > I see that ExternalType has a class var called AtomicTypes...should I
> > add something directly to this dictionary?
>
> IMO you shouldn't mess around with this at all.
>
> > Is there a better way, or should I just use the base types that the
> > typedefs represent?
>
> The latter. This way, it's at least obvious what's going on. You still can
> include the original signature as comment.
>
> If you really insist on using typedefs, you might add a class method
> that answers a dictionary mapping typedefs to basic types. It should be
> fairly easy to hack the compiler to honor these (see
> Parser>>externalType:).
>
> -- Bert
>





More information about the Squeak-dev mailing list