|
C++ Builder / Création et utilisation d'une DLL
//--- Déclarations des fonctions
dans le projet de la DLL
extern "C" __declspec(dllexport) int Minimum( int, int);
extern "C" __declspec(dllexport) int Maximum( int, int);
//--- Corps des fonctions dans le projet
de la DLL
//--- Minimun de deux entiers
int Minimum(int iNombre1, int iNombre2)
{
return ( ( iNombre1 < iNombre2 )?
iNombre1 : iNombre2);
}
//--- Maximum de deux entiers
int Maximum(int iNombre1, int iNombre2)
{
return ( ( iNombre1 > iNombre2 )?
iNombre1 : iNombre2);
}
//--- Déclarations des fonctions
dans le projet appelant les fonctions de la DLL
extern "C" __declspec(dllimport) int Minimum(int,int);
extern "C" __declspec(dllimport) int Maximum(int,int);
//--- Utilisation des fonctions dans
le projet appelant les fonctions de la DLL
int iMinimum = Minimum ( 5, 4 );
int iMaximum = Maximum ( 5, 4 );
|