Konzola.exe:
Kód:
HINSTANCE runtime;
runtime = LoadLibrary("Runtime.dll");
if(runtime == NULL && messageAllowed == 0)
{
MessageBox(0, "Runtime.DLL sa nepodarilo nahrát.", "Error", MB_OK | MB_ICONINFORMATION);
messageAllowed = 1;
}
else
{
RUNTIME SomeFunction = (RUNTIME)GetProcAddress(runtime,"SomeFunction");
SomeFunction(0,"Natazena DLL","Message", MB_OK);
}
FreeLibrary(runtime);
Runtime.dll:
Kód:
void DLL_EXPORT SomeFunction(HWND hMessage,const LPCSTR sometext, const LPCSTR title,int Flags)
{
MessageBoxA(hMessage, sometext, title,Flags);
}
a ukazatel RUNTIME definovaný ako:
Kód:
typedef void (WINAPI * RUNTIME)(HWND,LPCTSTR,LPCTSTR,int);