FFI, Ogg Vorbis, and char[]

Jason Dufair jase at dufair.org
Mon Nov 25 00:44:50 UTC 2002


Bert Freudenberg wrote:

>I think the field specs can have a byteSize parameter. Maybe this just
>works?
>
>#( ...
>   (header 'char' 282)
>   ... ) 
>  
>
Heh.  Talk about a case of RTFM.  Sorry I overlooked that.  This is 
exactly what I was looking for.  A few other questions for anyone who 
may be familiar with FFI:

If I have something declared in a C header as, for example, char**, can 
FFI handle pointers to pointers?

I need to pass a file pointer in to a foreign function.  Is there some 
way to get a file pointer in Smalltalk?

I have a recursive struct (a linked list, it seems).  Declared like:
struct alloc_chain{
  void *ptr;
  struct alloc_chain *next;
};
Trying to initialize the class (which does something like 
#enumerateFields or some such) when I define the fields method on the 
class side as
fields
    ^#(
    ('ptr' 'void*')
    ('next' 'AllocChain'))

sends Squeak out to lunch.  I've tried declaring 'next' as 'void*', but 
I'm not sure if that will work.  Any ideas?

Thanks for your help, all.  I'm no c hacker, but I sure hope I can get 
this to work via FFI.  Otherwise it's off to named primitives (blech!)

Jason Dufair




More information about the Squeak-dev mailing list