// stdafx.cpp : 只包括标准包含文件的源文件
// WxService.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息

#include "stdafx.h"

// TODO: 在 STDAFX.H 中
// 引用任何所需的附加头文件，而不是在此文件中引用
HMODULE g_hpool = NULL;
IWxAdoInterface* g_pAdoPool = NULL;
typedef IWxAdoInterface* (*CREATEINSTANCE)();
BOOL CreatePoolInstance()
{   //加载动态库
	g_hpool = (HMODULE)LoadLibrary(_T("WxAdoInterface.dll"));
	if (g_hpool == NULL)
	{
		CString strError = _T("");
		strError.Format(_T("error = %d"), GetLastError());
		return FALSE;
	}

	CREATEINSTANCE CreaetInstance = (CREATEINSTANCE)GetProcAddress(g_hpool, "CreateWxAdoPoolInstance");
	g_pAdoPool = CreaetInstance();

	return (g_pAdoPool == NULL) ? FALSE : TRUE;
}

void FreelyfzodbcLibrary()
{
	if (g_hpool)
	{
		g_pAdoPool->ReleasePool();
		g_pAdoPool->Release();
		FreeLibrary(g_hpool);
	}

	g_hpool = NULL;
	g_pAdoPool = NULL;
}