이 게시물은 내가 아는 모든 것에 대해 64 비트 시스템에 적용되지 않을 수 있지만 32 비트 Windows에서 작동합니다 ...
Gendef를 시도했는데 DEF 파일을 생성하지 못했습니다. DLL을 쓰기 시작한 내 자신의 목적을 위해이 문제를 이미 해결 한 후에는 TCC의 tiny_impdef.exe를 사용하는 것이 좋습니다. (TCC = Tiny C 컴파일러, Fabrice Bellard 및 나중에 Grishka.) DllTool (및 아마도 Gendef)과 달리 GCC를 사용했는지 여부는 출력 DLL을 제거하는 데 작동하는지 여부가 작동하는지 여부는 작동합니다!
GCC를 사용하는 경우 dlltool을 사용하여 DEF에서 *.a 라이브러리 파일을 생성하십시오. TCC는 두 개의 명령 줄을 사용하여 DLL 및 EXE의 전체 빌드를 수행합니다. 4 개의 가능한 조합이 모두 작동하면서 GCC 또는 TCC에 의해 DLL 또는 EXE를 구축 할 수있는 명령 세트가 있습니다.
아래의 배치 파일, 의지에 대한 약탈을 위해 ... 나는 그것이 더 나아질 수 있다고 확신하지만 적어도 그것은 깨끗하게 작동합니다.
@ECHO OFF
REM This system seems to work regardless of which compiler makes the DLL or the EXE. Try to simplify for GCC.
REM TCC 명령. 3 개의 파일, dll 및 def, exe를 만듭니다. rem e : coding tcc tcc.exe -shared e : coding tcc exames test_dll test_dll.c -oe : coding tcc examples test_dll test_dll.dll rem e : coding tcc tcc.exe e : coding tcc examples test_dll test_exe.c e : coding tcc examples test_dll test_dll.def -oe : coding tcc examples test_dll test_dll.exe
REM GCC 명령. 경고! 여전히 tcc의 tiny_impdef.exe가 필요합니다! e : coding gcc bin gcc.exe -s shared -ie : coding gcc 포함 -mwindows e : coding tcc examples test_dll test_dll.c -ooe : coding tcc examples test_dll test_dll.dll e : coding tcc "tiny_impdef.exe"e : coding tcc examples test_dll test_dll.dll> nul e : coding gcc mingw32 bin dlltool.exe -Dlltool.exe -Dlltool.exe -Dlltool.exe -Dlltool.exe -Dlltool.exe -dlltllt. e : coding tcc examples test_dll test_dll.def -le : coding tcc examples test_dll libtest_dll.a e : coding gcc bin gcc.exe -s-ie : coding coding coding include -mwindows e : coding tcc examples test_dll test_exe.c e : coding tcc examples test_dll libtest_dll.a -oe : coding tcc examples test_dll test_dll.exe
시작 e : coding tcc examples test_dll test_dll.exe
완전성을 위해 테스트 DLL의 C 코드는 다음과 같습니다.
#include <windows.h>
#define DLL_EXPORT __declspec(dllexport)
DLL_EXPORT void ZoodleWurdle(){
MessageBox (0, "Wurdle", "Zoodle", MB_ICONINFORMATION);
}
DLL_EXPORT void MangleWurzel(){
MessageBox (0, "Mangled", "Wurzels", MB_ICONINFORMATION);
}
gummidgisms에 대해 죄송하지만 어딘가에서 시작해야했는데 Foo와 Bar, Hello와 World를 좋아하지 않았습니다 ... 여기에 exe가 있습니다.
#include <windows.h>
void ZoodleWurdle();
void MangleWurzel();
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
ZoodleWurdle(); MangleWurzel();
return 0;
}