out_dll.cpp

 #include <windows.h>
#include <stdio.h>

/* Begin Global Variables */
    #define MAX 35
    char szBuffer[MAX];
   typedef UINT (CALLBACK* LPFNDLLFUNC1)(LPCSTR);

HINSTANCE hDLL;
LPFNDLLFUNC1 Str_Rev;
/* End Global Variables */

int main(int argc , char* argv[]) {
if(argc==2) {
/*
  If a file name was given to the command line
*/
if(strlen(argv[1])+1 > MAX) {
/*
  If the length of the string + Null terminating charactor
  is too big for our buffer...
*/
printf("Process request exceeds buffer limitations");
exit(1);
}
else strcpy(szBuffer,argv[1]);
/*
  Else copy the string from argument 2
  into our buffer.
*/
    }
    else {
    printf("Invalid number of arguments");
    exit(1);
    }
hDLL = LoadLibrary("out.dll");

if(hDLL){
Str_Rev = (LPFNDLLFUNC1)GetProcAddress(hDLL,"Str_Rev");
//MyFunc2 = (LPFNDLLFUNC2)GetProcAddress(hDLL,"MyDLLFunc2");

if(Str_Rev) Str_Rev(szBuffer);
else {
printf("Function address not found in DLL");
FreeLibrary(hDLL);
return false;
}
}
else printf("DLL failed to load");
if(hDLL) {
FreeLibrary(hDLL);
printf("Library exists in memory");
exit(1);
}
else printf("end of program");
return 0;
}

Project Homepage: