FFI, Ogg Vorbis, and char[]

David T. Lewis lewis at mail.msen.com
Mon Nov 25 11:36:40 UTC 2002


On Mon, Nov 25, 2002 at 11:32:04AM +0100, Bert Freudenberg wrote:
> On Sun, 24 Nov 2002, Jason Dufair wrote:
> > Bert Freudenberg wrote:
> > 
> > I need to pass a file pointer in to a foreign function.  Is there some 
> > way to get a file pointer in Smalltalk?
> 
> Not easily, that's hidden in the FilePlugin. You could open your files via
> FFI, too. Or you might read the FilePlugin code and find a way to access
> the actual file data.

Don't use the file pointer directly unless it's really necessary. If it
actually is necessary, there are examples in the plugin for OSProcess (see
Squeak Map).  The file pointer is embedded in a SQFile data structure, declared
in the FilePlugin.h in the platforms/Cross/plugins/FilePlugin directory.
On Windows, it refers to a Win32 HANDLE, and on other platforms it refers to a
(FILE *). The fileID instance variable of a StandardFileStream contains the
contents of the SQFile data structure.

Dave
 



More information about the Squeak-dev mailing list