load.c
/*
$RCSfile: load.c,v $
$Revision: 1.1 $
$Date: 1999-07-17 22:33:43-07 $
$Author: doomer $
this is the source to an application which will dynamically load
each our "old" and "new" DLLs.
*/
#include <windows.h>
#include <stdio.h>
typedef long (*p_lv_fn)(void);
int main(int argc, char *argv[]){
HANDLE dll_handle = 0;
p_lv_fn func1_ptr = 0;
printf("Loading old.dll\n");
dll_handle = LoadLibrary("old.dll");
if(!dll_handle){
fprintf(stderr, "Failure loading old.dll\n");
return -1;
}
func1_ptr = (p_lv_fn)GetProcAddress(dll_handle, "func1");
if(!func1_ptr){
FreeLibrary(dll_handle);
dll_handle = 0;
fprintf(stderr, "Failure trying to find func1 in old.dll\n");
return -1;
}
printf("Results of func1: %ld\n", func1_ptr());
func1_ptr = 0;
FreeLibrary(dll_handle);
dll_handle = 0;
return 0;
}
/*
$Log: load.c,v $
Revision 1.1 1999-07-17 22:33:43-07 doomer
Initial revision
*/