Não quero esgotar sua paciência, más analise isto por favor e me diga onde estou errando:
#include <windows.h>
#include <iostream>
#include <conio.h>
using namespace std;
int main ( ) {
HINSTANCE hDll;
hDll = LoadLibrary ( "minha.dll" );
if ( ! hDll ) {
cout << "Não foi possível carregar a dll" << endl;
getche();
exit ( 1 );
}
int ( WINAPI *func_1 ) ( int x, int y );
int ( WINAPI *func_2 ) ( int x, int y );
func_1 = ( int ( WINAPI * ) ( int x, int y ) ) GetProcAddress ( hDll, "soma" );
func_2 = ( int ( WINAPI * ) ( int x, int y ) ) GetProcAddress ( hDll, "sub" );
if ( !func_1 || !func_2 ) {
cout << "Não foi possível carregar as funções da DLL" << endl;
getche();
exit(1);
}
int x = 0, y = 0;
func_1 ( x, y );
func_2 ( x, y );
}
↧