circular deps

Scott bob at zone.com
Thu May 17 07:30:44 PDT 2007


Hi all,

Whats the correct way to use imports to handle the following type of circular dependency?

//main.d --------------8<---------------
import vec3, mat3, quat;
int main() { return 0; }

// mat3.d--------------8<---------------
module mat3;
import vec3, quat;
struct Mat3 { Vec3[3] m; }

// quat.d--------------8<---------------
module quat;
import vec3, mat3;
struct Quat {}

// vec3.d--------------8<---------------
module vec3;
import mat3, quat;
struct Vec3 { }


I get this back from the compiler....

unixbox$ dmd main.d vec3.d mat3.d quat.d 
vec3.d(6): struct vec3.Vec3 no size yet for forward reference
vec3.d(6): struct vec3.Vec3 no size yet for forward reference
vec3.d(6): struct vec3.Vec3 no size yet for forward reference
unixbox$

Thanks
S



More information about the Digitalmars-d mailing list