Hi. I am trying to write my first D program, and am quite stuck in several areas. This is on Ubuntu 10.10 with the dmd DMD64 D Compiler v2.055.
I want to create a generic struct for multi-dimensional arrays, in which the value parts can be shared. E.g., an array comprises a vector of its raveled elements, and an integer shape vector comprising the length of each axis. Thus, a 2x4 matrix of the integers [0,1,2,3,4,5,6,7] would have a shape vector of [2,4], and a value of the integers above, contained in a Parray struct, as shown in attachment 1. The calling environment is in prd.d. I want to be able to share shape vectors and values. For example, the above matrix might also have its value referenced by its raveled cousin, whose Parray shape would be [8]. I get the impression that calling by ref on Parray is what I want, as long as anything that wants to modify a Parray shape or value element explicitly copies the relevant part. However, none of this stuff works. Here's what I get: dmd prd.d -unittest prd.o:(.data+0x250): undefined reference to `_D5Array12__ModuleInfoZ' prd.o:(.data._D23TypeInfo_S5Array6Parray6__initZ+0x28): undefined reference to `_D5Array6Parray6__initZ' prd.o: In function `_D3prd4iotaFiZPS5Array6Parray': prd.d:(.text._D3prd4iotaFiZPS5Array6Parray+0x101): undefined reference to `_D5Array6Parray6__ctorMFNcAiAiZS5Array6Parray' collect2: ld returned 1 exit status --- errorlevel 1 This is not exactly illuminating, and I have no idea what sort of dumb mistake(s) I'm making in the code. Suggestions and educational pointers are very welcome! Thanks, Robert begin 644 Array.d M:6UP;W)T('-T9"YS=&1I;SL*"B\O(%!L=7)A;"!A<G)A>2!D871A('-T<G5C M='5R97,*+R\*+R\@02!P<F]G<F%M(')E9F5R<R!T;R!A;B!A<G)A>2!V:6$@ M82!087)R87DN(`HO+R!4:&4@4&%R<F%Y('!O:6YT<R!T;R!T:&4@87)R87DG M<R!S:&%P92!V96-T;W(@86YD"B\O(')A=F5L960@=F%L=64@=F5C=&]R+@HO M+PHO+R!!(%!L=7)A;"!A<G)A>2!I<R!A('!A:7(@;V8@=&AE(&%R<F%Y)W,@ M<VAA<&4@86YD(')A=F5L960@=F%L=64N"B\O"@IS=')U8W0@4&%R<F%Y('L* M("!I;G1;72!S:'`["B`@=6YI;VX@>PH@("`@8F]O;%M=("`@7V)V86P@/2!N M=6QL.PH@("`@:6YT6UT@("`@7VEV86P["B`@("!D;W5B;&5;72!?9'9A;#L* M("!]"B`@("`O+R!!9&0@;F5W(&)A<VEC('1Y<&5S(&AE<F4N"B`@("!T:&ES M*"!I;G1;72!S:'`L(&)O;VQ;72!V86PI('L*("`@("`@=&AI<RYS:'`@/2!S M:'`["B`@("`@('1H:7,N7V)V86P@/2!V86P["B`@("`@('=R:71E;&XH(D-R M96%T960@8F]O;"(I.PH@("`@?0H@("`@=&AI<R@@:6YT6UT@<VAP+"!I;G1; M72!V86PI('L*("`@("`@=&AI<RYS:'`@/2!S:'`["B`@("`@('1H:7,N7VEV M86P@/2!V86P["B`@("`@('=R:71E;&XH(D-R96%T960@:6YT(BD["B`@("!] M"B`@("!T:&ES*"!I;G1;72!S:'`L(&1O=6)L95M=('9A;"D@>PH@("`@("!T M:&ES+G-H<"`]('-H<#L*("`@("`@=&AI<RY?9'9A;"`]('9A;#L*("`@("`@ M=W)I=&5L;B@B0W)E871E9"!D;W5B;&4B*3L*("`@('T*"B\O<'5B;&EC.@HO M+R`@(&EN=%M=(&=E=%-H<"@I('L*+R\@("`@(')E='5R;B@@<VAP*3L*+R\@ M("!]"B\O("`@:6YT6UT@9V5T26YT*"D@>PHO+R`@("`@<F5T=7)N*"!?:79A M;"D["B\O("!]"GT*=6YI='1E<W0@>PH@('=R:71E;&XH(")G;W0@=&\@=6YI M='1E<W0@9F]R($%R<F%Y+F0@(BD["B`@875T;R!V(#T@4&%R<F%Y*"D["B`@ M87-S97)T*"`H;G5L;"`]/2!V+G-H<"D@)B8@*"!N=6QL(#T]('8N7VEV86PI M*3L*("!A<W-E<G0H("@@;G5L;"`]/2!V+E]B=F%L*2D["B`@87-S97)T*"`H M(&YU;&P@/3T@=BY?:79A;"DI.PH@(&%S<V5R="@@*"!N=6QL(#T]('8N7V1V (86PI*3L*?0H` ` end begin 644 prd.d M:6UP;W)T('-T9"YS=&1I;SL*:6UP;W)T($%R<F%Y.PH*+RH@4')O=&]T>7!E M(&9O<B!0;'5R86P@*R_BC;-.("HO"@I087)R87DJ(&EO=&$H(&EN="!Y*0I[ M("\J($EN9&5X(&=E;F5R871O<BP@;W)I9VEN(#`@*B\*("!I;G1;72!S:'!V M86P["B`@:6YT6UT@=F5C=F%L.PH@('-H<'9A;"`](&YE=R!I;G1;(#%=.PH@ M('9E8W9A;"`](&YE=R!I;G1;('E=.PH@('=R:71E;&XH('-H<'9A;"D["@H@ M(&9O<F5A8V@@*&DL(')E9B!E;#L@=F5C=F%L*2!["B`@("!E;"`](&-A<W0H M:6YT*6D["B`@?0H@('=R:71E;&XH('9E8W9A;"D["B`@"B`@875T;R!Z(#T@ M;F5W(%!A<G)A>2@@<VAP=F%L+"!V96-V86PI.R`O*B!!;&QO8V%T92!R97-U M;'0@*B\*("!R971U<FXH('HI.PI]"G5N:71T97-T('L*("!A=71O('9E8R`] M(&EO=&$H-2D["B`@+R]A=71O('-H<"`]('9E8RYG9713:'`H*3L*("`O+V%U M=&\@=F%L(#T@=F5C+F=E=$EN="@I.PH@("\O87-S97)T*"`U(#T]('-H<%LP M72D["B`@=W)I=&5L;B@B(&EO=&$@<VAA<&4@:7,@)61<;B(L("!V96,N<VAP M*3L*("!W<FET96QN*"(@:6]T82!V86QU92!I<R`E9%QN(BP@('9E8RY?:79A M;"D["GT*"FEN="!M86EN*"D*>PH@(&%U=&\@<"`](&EO=&$H(#4I.PH@('=R M:71E;&XH('`N<VAP*3L*("!W<FET96QN*"!P+E]I=F%L*3L*("!R971U<FXH &,"D["GT* ` end