コード例 #1
0
ファイル: mdns.cpp プロジェクト: acml/cvsnt
CMdnsHelperBase* CMdnsHelperBase::CreateHelper(const char *type, const char *dir)
{
	CLibraryAccess la;
	CMdnsHelperBase* (*pNewMdnsHelper)() = NULL;

	if(!type)
		type=MDNS_DEFAULT;

	CServerIo::trace(3,"Loading MDNS helper %s",type);
	cvs::string tmp = type;
	tmp+=SHARED_LIBRARY_EXTENSION;
	if(!la.Load(tmp.c_str(),dir))
		return false;
	pNewMdnsHelper = (CMdnsHelperBase*(*)())la.GetProc("CreateHelper");
	if(!pNewMdnsHelper)
		return NULL;
	CMdnsHelperBase *mdns = pNewMdnsHelper();
	la.Detach(); 
	return mdns;
}
コード例 #2
0
ファイル: SqlConnection.cpp プロジェクト: todace/G-CVSNT
CSqlConnection* CSqlConnection::CreateConnection(const char *db, const char *dir)
{
	CLibraryAccess la;
	CSqlConnection* (*pNewSqlConnection)() = NULL;

	cvs::string name;

	name = db;
	name += SHARED_LIBRARY_EXTENSION;

	CServerIo::trace(3,"Connecting to %s",db);
	if(!la.Load(name.c_str(),dir))
		return NULL;
	pNewSqlConnection = (CSqlConnection*(*)())la.GetProc("CreateConnection");

	if(!pNewSqlConnection)
		return NULL;
	CSqlConnection *conn = pNewSqlConnection();
	la.Detach();
	return conn;
}