[luau] C struct interdependency problem

Ray Strode halfline at hawaii.rr.com
Sat Jun 22 02:34:00 PDT 2002


Hi everyone.

I have a question about getting the compiler to grok some files with 
interdependent structs.

I've got something basically like this:

object.h
-----------
...
typedef struct Object Object;
typedef struct ObjectError ObjectError;
...
struct ObjectError {
   Error super_class;
   ...
};
...
struct Object {
   ObjectError *error;
   ...
};
...

error.h
---------
...
typedef struct Error Error;
...
struct Error {
    Stack super_class;
    ...
};
...

stack.h
----------
...
typedef struct LinkedList LinkedList;
...
struct LinkedList {
    Object superclass;
    ...
};
...

So basically the dependency tree is this:

+-----Object-----+<----+
|/////has-a://///|     |
|//////...///////|     |
|//ObjectError///|     |
|//////...///////|     |
+----------------+     |
        +--------------+
        |              
        .       
+---LinkedList---+<----+
|/////has-a://///|     |
|//////...///////|     |    
+----------------+     |
        +--------------+
        |              
        .              
+-----Stack------+<----+
|/////has-a://///|     |
|//////...///////|     |
+----------------+     |
        +--------------+
        |
        .
+--ObjectError---+
|/////has-a://///|
|//////...///////|
+----------------+  

Any idea how I can get this setup arranged so the compiler
believes everything is alright (e.g. where should the #includes
go and things)?

--Ray




More information about the LUAU mailing list