<commit_before>/* bzflag
* Copyright (c) 1993 - 2005 <NAME>
*
* This package is free software;  you can redistribute it and/or
* modify it under the terms of the license found in the file
* named COPYING that should have accompanied this file.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#include "WorldEventManager.h"

#ifdef _WIN32

#include <windows.h>

std::vector<HINSTANCE>	vLibHandles;

void loadPlugin ( std::string plugin, std::string config )
{
	int (*lpProc)(const char*);

	HINSTANCE	hLib = LoadLibrary(plugin.c_str());
	if (hLib)
	{
		lpProc = (int (__cdecl *)(const char*))GetProcAddress(hLib, "bz_Load");
		if (lpProc)
		{
			int ret =lpProc(config.c_str()); 
			vLibHandles.push_back(hLib);
		}
	}
}

void unloadPlugins ( void )
{
	int (*lpProc)(void);
	for (unsigned int i = 0; i < vLibHandles.size();i++)
	{
		lpProc = (int (__cdecl *)(void))GetProcAddress(vLibHandles[i], "bz_Unload");
		if (lpProc)
		{
			int ret =lpProc(); 
		}
	}
	vLibHandles.clear();
}

#else
// the other OSs need some DLL type loving!!!!
void loadPlugin ( std::string plugin, std::string config )
{
}

void unloadPlugins ( void )
{
}
#endif 


// Local Variables: ***
// mode:C++ ***
// tab-width: 8 ***
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
// ex: shiftwidth=2 tabstop=8<commit_msg>unload dlls when we are done with em.<commit_after>/* bzflag
* Copyright (c) 1993 - 2005 <NAME>
*
* This package is free software;  you can redistribute it and/or
* modify it under the terms of the license found in the file
* named COPYING that should have accompanied this file.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#include "WorldEventManager.h"

#ifdef _WIN32

#include <windows.h>

std::vector<HINSTANCE>	vLibHandles;

void loadPlugin ( std::string plugin, std::string config )
{
	int (*lpProc)(const char*);

	HINSTANCE	hLib = LoadLibrary(plugin.c_str());
	if (hLib)
	{
		lpProc = (int (__cdecl *)(const char*))GetProcAddress(hLib, "bz_Load");
		if (lpProc)
		{
			int ret =lpProc(config.c_str()); 
			vLibHandles.push_back(hLib);
		}
	}
}

void unloadPlugins ( void )
{
	int (*lpProc)(void);
	for (unsigned int i = 0; i < vLibHandles.size();i++)
	{
		lpProc = (int (__cdecl *)(void))GetProcAddress(vLibHandles[i], "bz_Unload");
		if (lpProc)
		{
			int ret =lpProc(); 
		}
		FreeLibrary(vLibHandles[i]);
	}
	vLibHandles.clear();
}

#else

std::vector<void*>	vLibHandles;

void loadPlugin ( std::string plugin, std::string config )
{
	int (*lpProc)(const char*);

	void*	hLib = dlopen(plugin.c_str(),RTLD_LAZY);
	if (hLib)
	{
		lpProc = dlsym(hLib,"bz_Load");
		if (lpProc)
		{
			int ret =(*lpProc)(config.c_str()); 
			vLibHandles.push_back(hLib);
		}
	}

}

void unloadPlugins ( void )
{
	int (*lpProc)(void);
	for (unsigned int i = 0; i < vLibHandles.size();i++)
	{
		lpProc = dlsym(vLibHandles[i], "bz_Unload");
		if (lpProc)
		{
			int ret =(*lpProc)(); 
		}
		dlClose(vLibHandles[i]);
	}
	vLibHandles.clear();
}
#endif 


// Local Variables: ***
// mode:C++ ***
// tab-width: 8 ***
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
// ex: shiftwidth=2 tabstop=8
{'fraction_non_alphanumeric': 0.15944997074312464, 'fraction_numerical': 0.009069631363370393, 'mean_word_length': 4.035346097201767, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5798064', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1263, 'n_words': 342}