I am trying to create a pointer that would point to Out32 function in inpout32.dll.
and the following code does not work, can someone give me more insight about
why it doesnt work?
Code:
#include <iostream>
#include <windows.h>
     
int main()
{
   HINSTANCE Dllload = LoadLibrary("inpout32.dll");
 
   if (Dllload)
   {
           
     void (*outport)(short adress, short value) = GetProcAddres(Dllload, "Out32");
     std::cout<<"success";
     std::cin.get();
   }
   else
   { 
       std::cout<<"inpout32.dll failed to load";
       std::cin.get();
   }
}
it loads inpout32.dll ok, but it has problem with that function pointer initialization
compiler has this to say about my code:
In function `int main()':
invalid conversion from `int (*)()' to `void (*)(short int, short int)'

but the code with typedef works,
Code:
#include <iostream>
#include <windows.h>

typedef void (*outportpoint)(short adress,short value);     
int main()
{
   HINSTANCE Dllload = LoadLibrary("inpout32.dll");
 
   if (Dllload)
   {
            outportpoint outport;
            outport = (outportpoint) GetProcAddress(Dllload, "Out32");
            std::cout<<"success";
            std::cin.get();
   }
   else
   { 
       std::cout<<"inpout32.dll failed to load";
       std::cin.get();
   }
}
isn't typedef used here to make creation of multiple pointers easier insted of declaring each new pointer?