Cargar un Dll
Hola, esto tratando de cargar un dll desde un funcion en... el codigo me compila, pero a la hora de ejecutarlo ocurre cierto error (no se cual sera), y el prompt del DOS se cierra. Cualquiera que me pueda ayudar se lo agradeceria. La funcion que llama al DLL se las anexo:
#include <windows.h>
int i = 1;
int OpenPort(char *puerto, long velocidad);
typedef int (* FUNCTION1)(char *,long);
int main()
{
i = OpenPort("COM1", 57600);
return 1;
}
int OpenPort(char *puerto, long velocidad)
{
int i = 0;
HINSTANCE hinstLib;
FUNCTION1 IOpenPort;
/ Get a handle to the DLL module.
hinstLib = LoadLibrary("iclass.dll");
// If the handle is valid, try to get the function address.
if (hinstLib != NULL) // if (hinstLib != NULL)
{
IOpenPort = (FUNCTION1)GetProcAddress (hinstLib, "IOpenPort");
// If the function address is valid, call the function.
if (IOpenPort)
{
i = IOpenPort(puerto, velocidad);
// Free the DLL module.
FreeLibrary(hinstLib);
}
}
return i;
}
#include <windows.h>
int i = 1;
int OpenPort(char *puerto, long velocidad);
typedef int (* FUNCTION1)(char *,long);
int main()
{
i = OpenPort("COM1", 57600);
return 1;
}
int OpenPort(char *puerto, long velocidad)
{
int i = 0;
HINSTANCE hinstLib;
FUNCTION1 IOpenPort;
/ Get a handle to the DLL module.
hinstLib = LoadLibrary("iclass.dll");
// If the handle is valid, try to get the function address.
if (hinstLib != NULL) // if (hinstLib != NULL)
{
IOpenPort = (FUNCTION1)GetProcAddress (hinstLib, "IOpenPort");
// If the function address is valid, call the function.
if (IOpenPort)
{
i = IOpenPort(puerto, velocidad);
// Free the DLL module.
FreeLibrary(hinstLib);
}
}
return i;
}
