www.digitalmars.com         C & C++   DMDScript  

DMDScript - D2.0 and C++ classes supported linking?

reply Doug <doomgamer hotmail.com> writes:
Is there anyway to access a c++ defined class with D, or must all member
function calls be called from within the c++ code in order to have information
brought up.  Or is there a way to create a object of type myCPPlusClass  that
will allow for more direct access to the member functions of the class?  If it
is possible some example code of a working basic C++ class and it's calling
corresponding D code.  would be appreciated, I am trying to see if I am trying
to find a way to reuse some of my old C++ classes to test out the linking in
D2.0

For example if i wanted to have D do the interface, and C++ libraries handle
the back end math functions.
Apr 14 2010
parent Walter Bright <newshound1 digitalmars.com> writes:
Doug wrote:
 Is there anyway to access a c++ defined class with D, or must all member
 function calls be called from within the c++ code in order to have information
 brought up.  Or is there a way to create a object of type myCPPlusClass  that
 will allow for more direct access to the member functions of the class?  If it
 is possible some example code of a working basic C++ class and it's calling
 corresponding D code.  would be appreciated, I am trying to see if I am trying
 to find a way to reuse some of my old C++ classes to test out the linking in
D2.0
 
 For example if i wanted to have D do the interface, and C++ libraries handle
 the back end math functions.

D can access C++ classes as long as those classes are single inheritance. Just mark them in the D declaration with extern (C++).
May 15 2010