Das Programm benötigt die DLL, die zur Zeit im gleichen Ordner ist.
Nun würde ich diese DLL gerne mit einbinden und sie dann vom Programm aus extrahieren (in den gleichen Ordner schreiben) oder sie sogar als Modul benutzen.
Habe soeben erfolglos folgendes getestet:
In \res\:
datei.dll
main.rc
Inhalt main.rc:
|
C Quellcode
|
1
|
1001 BIN "res\\datei.dll"
|
In main.c:
|
C Quellcode
|
1
2
3
4
5
6
7
8
9
|
#define IDR_DLL 1001
(...)
int main(int argc, char *argv[]) {
ExtractRes("datei.dll",IDR_DLL);
(...)
|
und
|
C Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
char ExtractRes(char *szDest, WORD wResName)
{
FILE* hResFile;
HRSRC hResLoad;
HGLOBAL hResData;
LPCSTR lpResData;
char szFinalPath[MAX_PATH];
hResFile = fopen(szDest,"wb");
hResLoad = FindResource(NULL,MAKEINTRESOURCE(wResName),"BIN");
hResData = LoadResource(NULL,hResLoad);
lpResData = (LPCSTR)LockResource(hResData);
if(hResLoad != NULL && hResData != NULL && lpResData != NULL)
{
fwrite(lpResData,1,SizeofResource(NULL,hResLoad),hResFile);
fclose(hResFile);
FreeResource(hResData);
}
return(0);
}
|
Error:
main.c:177: error: conflicting types for 'ExtractRes'
main.c:25: error: previous implicit declaration of 'ExtractRes' was here
Edit:
Und wenn ich in Dev-C++ bei "Project Options" -> "Makefile" -> "Include the following files into the MakeFile" die Datei auswähle, bekomme ich folgenden Error:
2 ...\res\datei.dll *** missing separator. Stop.