Muokkaa

Jaa


Using Load-Time Dynamic Linking

After you have created a DLL, you can use the functions it defines in an application. The following is a simple console application that uses the myPuts function exported from Myputs.dll (see Creating a Simple Dynamic-Link Library).

Because this example calls the DLL function explicitly, the module for the application must be linked with the import library Myputs.lib. For more information about building DLLs, see the documentation included with your development tools.

#include <windows.h> 

extern "C" int __cdecl myPuts(LPCWSTR);   // a function from a DLL

int main(VOID) 
{ 
    int Ret = 1;

    Ret = myPuts(L"Message sent to the DLL function\n"); 
    return Ret;
}

Load-Time Dynamic Linking