I'm trying to create a DLL with the code that the teacher passed, but it does not compile properly. The warning is appearing:
"No local application has been provided, you can set it in the Run menu, Parameters"
Parâmetros
be? HelloWord
on the screen, would I have to create a .dll
file in a text editor and put HelloWord
inside it? And then compile it? The main DLL follows:
#include <windows.h>
#include <iostream>
using namespace std;
typedef void (*MyFunc)(void);
/* run this program using the console pauser or add
your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
HINSTANCE hinst;
MyFunc Hello;
hinst = LoadLibrary("MyDLL.dll");
if (!hinst)
{
MessageBox(0,"DLL File not found!", "Error", MB_ICONERROR);
exit(0);
}
Hello = (MyFunc)GetProcAddress(hinst,"HelloWorld");
Hello();
FreeLibrary(hinst);
exit(0);
return 0;
}
The following is the DLL of the function:
#ifndef _DLL_H
#define _DLL_H
#if BUILDING_DLL
#define DLLIMPORT _declspec(dllexport)
#else
#define DLLIMPORT _declspec(dllimport)
#endif
DLLIMPORT void HelloWord();
#endif