/* .objs\functions.o:functions.cpp:(.bss+0x0): multiple definition of `inp32' .objs\main.o:main.cpp:(.bss+0x0): first defined here .objs\functions.o:functions.cpp:(.bss+0x4): multiple definition of `oup32' .objs\main.o:main.cpp:(.bss+0x4): first defined here */ /* Fichier main.cpp */ #include #include #include #include // #define INVERT #include "functions.h" using namespace std; int main( ) { HINSTANCE hLib; NEWCHAR output; output.dec = 0; // chargement de la librairie hLib = LoadLibrary("INPOUT32.DLL"); if (hLib == NULL) { cout << "Chargement de la librairie echoue !" << endl; return EXIT_FAILURE; } // Recuperation de l'adresse de la fonction Out32(port, data); et Inp32(port); inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32"); if (inp32 == NULL) { cout << "GetProcAddress for Inp32 Failed.\n"; return EXIT_FAILURE; } oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32"); if (oup32 == NULL) { cout << "GetProcAddress for Out32 Failed.\n"; return EXIT_FAILURE; } /* ......................... */ } /* Fichier functions.h */ typedef short _stdcall (*inpfuncPtr)(short portaddr); typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum); typedef union NEWCHAR { unsigned char dec; //decimal struct { #ifndef INVERT bool bit1:1; bool bit2:1; bool bit3:1; bool bit4:1; bool bit5:1; bool bit6:1; bool bit7:1; bool bit8:1; #endif #ifdef INVERT bool bit8:1; bool bit7:1; bool bit6:1; bool bit5:1; bool bit4:1; bool bit3:1; bool bit2:1; bool bit1:1; #endif }; }; inpfuncPtr inp32; oupfuncPtr oup32; int menu(); int menu_bobines(); char* bin (NEWCHAR num); void send(int value); /* Fichier functions.cpp */ /*Ya qu'une utilisation de oup32 dans une fonction : */ void send(int value) { (oup32)(0x378, value); NEWCHAR v; v.dec = value; cout << " Donnees envoyees: " << bin(v) << endl; }