stdafx.cpp 792 B

123456789101112131415161718192021222324252627282930313233343536
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // lyfzServer.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. HMODULE g_hpool = NULL;
  6. IODBCInterface* g_pODBCPool = NULL;
  7. typedef IODBCInterface* (*CREATEINSTANCE)( );
  8. BOOL lyfzCreatePoolInstance( )
  9. { //加载动态库
  10. g_hpool = ( HMODULE )LoadLibrary(_T("ODBCPOOL.dll"));
  11. if ( g_hpool == NULL )
  12. {
  13. CString strError = _T("");
  14. strError.Format(_T("error = %d"), GetLastError());
  15. AfxMessageBox(strError);
  16. return FALSE;
  17. }
  18. CREATEINSTANCE CreaetInstance = (CREATEINSTANCE)GetProcAddress(g_hpool, "lyfzCreatePoolInstance");
  19. g_pODBCPool = CreaetInstance();
  20. return (g_pODBCPool == NULL) ? FALSE : TRUE;
  21. }
  22. void FreelyfzodbcLibrary()
  23. {
  24. if ( g_hpool )
  25. FreeLibrary(g_hpool);
  26. g_hpool = NULL;
  27. g_pODBCPool = NULL;
  28. }