[M3devel] Referencing opaque C structs in M3 code?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Fri Mar 5 22:03:10 CET 2010


On Thu, Mar 04, 2010 at 04:59:42PM -0500, Tony Hosking wrote:
> You can assume that ADDRESS is entirely interchangeable with a C void *.

What struct opaque_foo_t provides that void doesn't is some further 
type-checking -- struct opaque_foo_t is a different type from struct 
other_foo_t.

Presumably you should use Modula 3 techniques for making an opaque 
types in your interface.

- hendrik

> 
> Antony Hosking | Associate Professor | Computer Science | Purdue University
> 305 N. University Street | West Lafayette | IN 47907 | USA
> Office +1 765 494 6001 | Mobile +1 765 427 5484
> 
> 
> 
> 
> On 4 Mar 2010, at 16:29, Chris wrote:
> 
> > Alright, this has thrown me for a bit of a loop...no pun intended...
> > 
> > Suppose I'm linking my Modula 3 code with a C library where the public API has a declaration like this...
> > 
> > typedef struct opaque_foo_t opaque_foo_t;
> > 
> > And the type opaque_foo_t is defined in the private part of the library.
> > 
> > Do I need to create a seperate representation of the structure for my Modula3 program or can I just create a pointer for it and pass the pointer around? Assuming of course I dont have to actually reference anything inside opaque_foo_t.  Would I just create an UNTRACED REF Ctypes.void_star or something similiar?
> > 
> > I'm a little puzzled. Any help would be appreciated.
> > 
> > 
> > 
> > -- 
> > Chris <Highjinks at gmx.com>
> 



More information about the M3devel mailing list