What Is FFI

Robert Withers withers at vnet.net
Mon Feb 7 23:31:34 UTC 2000


Andreas, 

Gruess Gott!  This sounds very cool.  I had a thought though.  Why don't
we split the job between 2 VMs, with some shared memory, and let the
other VM be the one that crashes.  Be able to detect and log it, and
restart another VM.  Flag that call as disabled and keep going?  

A small group of us are just beginning to look at LindaSpaces and it has
the extreme ability to manage a shared memory space between 2 VMs.  Much
of the core could probably be written in C.  I am currently having very
spurious network problems, which are obviously due to me blowing
something off somewhere in there.  

Please read today's rant on where I want to go with Squeak at the bottom 
http://smalltalk.swiki.net/3

Linda stuff, including a good overview from York
http://smalltalk.swiki.net/15

cheers,
Rob

"Raab, Andreas" wrote:
> 
> Steve,
> 
> In a nutshell: FFI is dangerous ;-)
> In another nutshell: FFI allows you to call functions written in other
> languages (mostly C), so one can call (for instance) OS functions directly
> from Squeak. Have a look at the examples, they all use functions that are
> not in Squeak but live somewhere in the outside world. This of course
> implies that you have to play by the rules of the outside (C) world - or in
> other words, if you make a mistake you'll not drop into the debugger but
> Squeak will just crash. That's what the first explanation means.
> 
> The FFI stuff is in a way related to pluggable primitives since it's using
> several of the mechanisms pluggable primitives use. But there are major
> differences:
> * The FFI is for interfacing existing libraries only. If you don't have an
> existing library that does what you want you'll have to write it - and
> that's basically what the pluggable primitives are intended for.
> * While it is possible to write a set of pluggable primitives that interface
> existing libraries (such as the AppleScript plugin) you don't have to do it
> any longer. The FFI does all the necessary conversions for you. The
> AppleScript stuff could be written using the FFI without the need to have a
> separate plugin for it.
> * The FFI is slow compared to pluggable primitives. Since there are many
> generic conversions necessary the overhead of calling C functions directly
> is very high. That doesn't matter as long as you're calling functions that
> actually do quite a bit of work but if you're concerned about the speed
> (e.g., when you call these functions a zillion times per second) you are
> much better off using pluggable primitives.
> * The FFI is very platform dependent. Pluggable primitives give you a way of
> defining abstract interfaces (e.g., primitives) to the provided
> functionality. When using the FFI you talk to the underlying system
> directly.
> 
>   Andreas
> 
> > -----Original Message-----
> > From: Steve Thompson [mailto:sthompso at connertech.com]
> > Sent: Monday, February 07, 2000 7:52 AM
> > To: Raab, Andreas
> > Subject: What Is FFI
> >
> >
> > Andreas! -,
> >
> > > > There is also a complete Foreign Function
> > > > Interface package not described here, but with a number of useful
> > > > examples in the updates.
> >
> > Could you tell me, in a nutshell, what FFI is all about?  Is
> > this connected
> > in some way with PluggablePrimitives?
> >
> > Thanks and best regards!,
> >
> > Steve Thompson
> > sthompso at connertech.com
> > Steve_Thompson at prodigy.net
> >

-- 
--------------------------------------------------
Smalltalking by choice.  Isn't it nice to have one!





More information about the Squeak-dev mailing list