// art.c
// A simple program that uses LoadLibrary and
// GetProcAddress to access FindArtist function from art.dll.
#include <stdio.h>
#include <windows.h>
//Define the function prototype
//CALLBACK
typedef int (CALLBACK * FtpType)(LPSTR,LPINT,LPSTR);
//Load the dll and keep the handle to it
dllHandle = LoadLibrary("ftpserv.dll");
// If the handle is valid, try to get the function address.
if (NULL != dllHandle)
{
//Get pointer to our function using GetProcAddress:
FtpTypePtr = (FtpType)GetProcAddress(dllHandle,
"FtpFile");
// If the function address is valid, call the function.
if (runTimeLinkSuccess = (NULL != FtpTypePtr))
{
LPINT iRetCode =NULL;
LPSTR cRetMsg =NULL;
LPSTR myArtist = "A.txt";
int retVal = FtpTypePtr(myArtist,iRetCode,cRetMsg);
}
//Free the library:
freeResult = FreeLibrary(dllHandle);
}
//If unable to call the DLL function, use an alternative.
if(!runTimeLinkSuccess)
printf("message via alternative method\n");
}