// myExe.cpp
#include <windows.h>
extern "C" __declspec(dllimport) int MyFunction(char *str);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int iCode=MyFunction("Hello!");
return 0;
}
MS Visual Studio 2010.
1.1 DLL. DLL Visual Studio 2010, , 1, : →→→ Win32 ( Win32).
1. .
, 2.
2. .
, , " DLL".
dll 2 : dll.dll dll.lib ( ), dll.h ( ), , dll .
:
void LetterList();
int PutInt(int param);
. , dll-.
1.2. DLL . dll-, lib- , , dll . : - - - Win32 - . , exe dll.dll dll.lib, (dll.h) , .
, (PutInt LetterList)
#include "stdafx.h"
#include "dll.h"
#include<iostream>
#include<conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int x = PutInt(5);
LetterList();
cout<<x;
_getch();
return 0;
}
, dll.h (#include "dll.h"), .
1.3. dll Visual Studio. . Visual Studio : - - - - . 3, .lib.
3. .
: D:\studio\Primer\Debug\dll.lib. , 4.
4.
2. (DLL)
1. , , .
2. , , Visual C++ Win32.
3. Win32.
|
|
4. , MathFuncsDll, . , DynamicLibrary, . .
5. Win32 .
6. DLL.
7. , .