DLL Linking

vermi moi_anti_spam_ at vermi.fr
Tue Jun 19 09:27:12 PDT 2007


If you want the source code of my dll, it's so simple :

//// CODE BEGIN

import std.c.windows.windows;

HINSTANCE hInst;

extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
    switch (ulReason)
    {
        case DLL_PROCESS_ATTACH:
	    break;

        case DLL_PROCESS_DETACH:
	    break;

        case DLL_THREAD_ATTACH:
	    return false;

        case DLL_THREAD_DETACH:
	    return false;

	    default:
    }

    hInst = hInstance;
    return true;
}

// La fonction main() ne sert strictement a rien a part a faire fonctionner la compilation
void main() { }


//// END OF CODE


The void main() { } allow me to link the dll, if I don't put it, the linker tell me the message I wrote before.

This code is copy/past from samples on the digitalmars website.


More information about the Digitalmars-d-learn mailing list