Using a c struct with FFI

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Wed May 21 17:29:46 UTC 2003


Am Mittwoch, 21.05.03 um 15:14 Uhr schrieb erollo:

> However, we need to use external c structures. We tried to make 
> subclasses
> of ExternalStructure as in X11 exemples provided by FFI but we didn't
> manage to do it. Can someone help us and give us the correct syntax ?

See, for example, http://swiki.gsug.org/sqfixes/512.html

This is an interface to gethostbyname() and gethostbyaddr() which use 
this struct:

struct hostent
{
         char *h_name;                   /* Official name of host.  */
         char **h_aliases;               /* Alias list.  */
         int h_addrtype;                 /* Host address type.   */
         int h_length;                   /* Length of address.   */
         char **h_addr_list;             /* List of addresses from name 
server.  */
         #define h_addr  h_addr_list[0]  /* Address, for backward 
compatibility. */
};

-- Bert



More information about the Squeak-dev mailing list