2
I am trying to create a DLL with the code that the teacher passed, but it does not compile correctly. Keeps appearing the warning:
"No local application provided. You can set it in the Run menu, Parameters"
- What would those be
Parâmetros
which I must put? - In this case I want to show the
HelloWord
on the screen, I would have to create a file.dll
in a text editor and put inside itHelloWord
? And then compile it?
Follow the main DLL:
#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;
}
Follows the function DLL:
#ifndef _DLL_H
#define _DLL_H
#if BUILDING_DLL
#define DLLIMPORT _declspec(dllexport)
#else
#define DLLIMPORT _declspec(dllimport)
#endif
DLLIMPORT void HelloWord();
#endif