typedef bool __cdecl TEXTURE_LOADER char path cTexture tex Resources c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
typedef bool (__cdecl *TEXTURE_LOADER)(char *path,cTexture tex);
//Resources.cpp
typedef bool (__cdecl *TEXTURE_LOADER)(char *path,cTexture tex);
long cResources::SetResourceFormat(vector <string> &v_command)
{
cLibraris lib;
lib.format = v_command[1];
lib.res_type = v_command[2];
lib.relative_path = v_command[3];
lib.objName = v_command[4];
lib.hModule = LoadLibrary(v_command[3].c_str());
if(!lib.hModule)
return 0;
resources.push_back(new cLibraris(lib));
TEXTURE_LOADER loader = (TEXTURE_LOADER)GetProcAddress(lib.hModule,v_command[4].c_str());
cTexture tex;
(loader)("D:\\qwe.bmp",tex);
return 0;
}
// texture.h // dll
#include "..\\SpaceWar\\MainObject.h"
#include "..\\SpaceWar\\OneResource.h"
#include "..\\SpaceWar\\Texture.h"
extern "C"
__declspec(dllexport) bool __cdecl bmp_loader(char *path,cTexture tex)
{
HANDLE hFile = CreateFile(path,FILE_ALL_ACCESS,FILE_SHARE_DELETE | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile == 0 || hFile == INVALID_HANDLE_VALUE)
return false;
return true;
}