首页 > 代码库 > DLL

DLL

 1 typedef IUnknown * (* CREATEFUNCPTR)();
 2 
 3 IUnknown * CallCreateInstance(char * name)
 4 {
 5     HINSTANCE hComponent = ::LoadLibrary(name);
 6     if (hComponent == NULL)
 7     {
 8         // ...
 9         return NULL;
10     }
11 
12     CREATEFUNCPTR pFunc = (CREATEFUNCPTR)::GetProcAddress(hComponent, "CreateInstace");
13     if (pFunc == NULL)
14     {
15         // ...
16         return NULL;
17     }
18 
19     return pFunc();
20 }