Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Index Visual C++ and MFC Fundamentals


double MOISemiCircleX(double r)
{
return r * r * r * r * PI / 8;
}
double MOISemiCircleXC(double r)
{
return 0.110 * r * r * r * r;
}
double MOISemiCircleYC(double r)
{
return MOISemiCircleX(r);
}

// Triangle
double MOITriangleX(double b, double h, int)
{
return b * h * h * h / 12;
}
double MOITriangleXC(double b, double h, int)
{
return b * h * h * h / 36;
}


  1. To add a definition file, display the Add New Item dialog box again. In the
    Templates list, click Module-Definition File (.def)

  2. In the Name edit box, type MomentInertia and press Enter

  3. Change the file as follows:


LIBRARY MomentInertia

EXPORTS
MOIRectX
MOIRectY
MOIRectXC
MOIRectYC

MOICircleXC
MOICircleYC

MOISemiCircleX
MOISemiCircleXC
MOISemiCircleYC;

MOITriangleX
MOITriangleXC


  1. To create the DLL, on the main menu, click Build -> Build MomentInertia


22.5.2..Usage of a Definition File DLL........................................................


Although we mentioned that you can create a definition file to have an import library,
you do not have to use it, although you can. The technique we used above allows the
compiler to know that you need an import library. This means that there are at least two
different ways you can make use of a definition file (as we stated already, the most
difficult aspect of DLL is based on decisions, not how to create a library).
Free download pdf