← Back to team overview

yade-dev team mailing list archive

reason of failing dynamic_casts

 

Janek,

I finally found why dynamic_cast was failing on NormalShearInteraction
(remember? We had to put static_cast in GlobalStiffnessCounter just
before the .12 release). Well, the point is that every class that can be
cast to must have at least one virtual method defined in the .cpp file
(hence in the shared object); I assume that otherwise typeinfo is not
put at all into the plugin during linking or something like that, and
casting fails at runtime. If you have some idea on the real cause of
this, let me know.

I discovered this with SpheresContactGeometry that I changed. The
solution was to put at least the empty virtual descructor to the .cpp files.

I reverted the static_cast in GlobalStiffnessCounter and it works fine.

Regards, Vaclav