Array of struct pointers error

Szymon Gatner noemail at gmail.com
Wed Feb 26 01:56:38 PST 2014


I want to keep a list of pointers-to-C-struct but this line:

   cpBody* cpBodies_[];
   cpBodies_ ~= cpBodyNew(0, 0);

gives:

Error	1	Error 42: Symbol Undefined 
_D5dchip6cpBody6cpBody11__xopEqualsFKxS5dchip6cpBody6cpBodyKxS5dchip6cpBody6cpBodyZb 
(bool dchip.cpBody.cpBody.__xopEquals(ref 
const(dchip.cpBody.cpBody), ref 
const(dchip.cpBody.cpBody)))	D:\projects\DeeDee\

where cpBodyNew(float, float) returns cpBody*, which is struct.

Interestingly, when I wrap cpBopy* into a another struct (or a 
Tuple) like so:

struct Body
{
   private cpBody* bdy_;
}

there is no problem to do

Body bodies[];
bodies ~= Body(cpBodyNew(0, 0));

which I use as a workaround. I am using DMD 2.065.



More information about the Digitalmars-d-learn mailing list