この投稿は、私が知っているすべてのために64ビットシステムに適用されない場合がありますが、32ビットウィンドウで動作します...
gendefを試してみましたが、defファイルを作成できませんでした。 DLLを書き始めた私自身の目的のためにすでにこの問題を解決してきたので、TCCのtiny_impdef.exeを使用することをお勧めします。 (TCC = Tiny C Compiler、Fabrice Bellard、および後にGrishkaによる。)Dlltool(およびおそらくGendef)とは異なり、GCCが出力DLLを削除するために-sを使用したかどうかに加えて機能します。
dlltoolを使用して、GCCを使用する場合、DEFから *.Aライブラリファイルを生成します。 TCCは、2つのコマンドラインのみを使用して、DLLとEXEのビルド全体を実行します。 DLLまたはEXEをGCCまたはTCCによって構築することを可能にする一連のコマンドがあり、4つの可能な組み合わせすべてが機能します。
以下のバッチファイル、自由に略奪するために...私はそれを改善することができると確信していますが、少なくともそれはそのままきれいに動作します。
@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コマンド。 DLLとdefの3つのファイルを作成し、次にExeを作成します。 Rem e: coding tcc tcc.exe -shared e: coding tcc examples test_dll test_dll.c -oe: coding tcc examples test_dll test_dll.dll rem e: coding tcc 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 include -mwindows e: coding tcc examples test_dll test_dll.c -oe: coding tcc emplyples 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 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 gcccc include -mwindows e: coding tcc examples test_dll test_exe.c e: coding tcc examples test_dll libtest_dll.a -oe: coding tcc examples 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);
}
ガムミッジズムについては申し訳ありませんが、私はどこかから始めなければなりませんでした、そして私はFooとBar、またはHello and Worldが好きではありませんでした...ここにExeがあります:
#include <windows.h>
void ZoodleWurdle();
void MangleWurzel();
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
ZoodleWurdle(); MangleWurzel();
return 0;
}