ha mince j'ai mis le mauvais header :
voici l'original qui ne passe pas :
Code C/C++ :
#include "stdafx.h"
#include "windows.h"
#ifndef INPOUT32HEADER_H_INCLUDED
#define INPOUT32HEADER_H_INCLUDED
typedef short _stdcall (*COM_Inp)(short AddrPort);
typedef void _stdcall (*COM_Outp)(short AddrPort, short Donnees);
HINSTANCE COM_hLib;
COM_Inp Lire;
COM_Outp Ecrire;
inline int COM_Init()
{
COM_hLib = LoadLibrary("inpout32.dll"); // chargement de la DLL
if (COM_hLib == NULL) // Chargement de la DLL impossible
{
return -1;
}
Lire = (COM_Inp) GetProcAddress(COM_hLib, "Inp32");//pointeur définit sur cette fonction
if (Lire == NULL) // Pointage sur cette fonction impossible
{
return -2;
}
Ecrire = (COM_Outp) GetProcAddress(COM_hLib, "Out32"); //pointeur définit sur cette fonction
if (Ecrire == NULL) // Pointage sur cette fonction impossible
{
return -3;
}
return 0; // tout à bien fonctionné
}
inline void COM_Fin() // Libère la DLL
{
FreeLibrary(COM_hLib);
}
#endif // INPOUT32HEADER_H_INCLUDED
les erreurs :
Error 1 error C2059: syntax error : '(' 7
Error 2 error C2059: syntax error : '(' 8
Error 3 error C2146: syntax error : missing ';' before identifier 'Lire' 10
Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 10
...
Error 10 error C2146: syntax error : missing ';' before identifier 'GetProcAddress' 24
ect ....
Oui c'est bien (VS) Visual studio 2008
merci