<commit_before>//..............................................................................
//
//  This file is part of the AXL library.
//
//  AXL is distributed under the MIT license.
//  For details see accompanying license.txt file,
//  the public copy of which is also available at:
//  http://tibbo.com/downloads/archive/axl/license.txt
//
//..............................................................................

#pragma once

#define _AXL_SYS_DYNAMICLIBRARY_H

#include "axl_g_Pch.h"

#if (_AXL_OS_WIN)
#	include "axl_sys_win_Library.h"
#	include "axl_sl_String.h"
#elif (_AXL_OS_POSIX)
#	include "axl_sys_psx_DynamicLibrary.h"
#endif

namespace axl {
namespace sys {

//..............................................................................

#if (_AXL_OS_WIN)

class DynamicLibrary
{
protected:
	win::Library m_library;

public:
	bool
	open (const sl::StringRef& fileName)
	{
		char buffer [256];
		sl::String_w fileName_w (ref::BufKind_Stack, buffer, sizeof (buffer));
		fileName_w = fileName;

		return m_library.loadLibrary (fileName_w);
	}

	void
	close ()
	{
		m_library.close ();
	}

	void*
	getFunction (const sl::StringRef& name)
	{
		return m_library.getProcAddress (name);
	}
};

//..............................................................................

#elif (_AXL_OS_POSIX)

class DynamicLibrary
{
protected:
	psx::DynamicLibrary m_dynamicLibrary;

public:
	bool
	open (const sl::StringRef& fileName)
	{
		return m_dynamicLibrary.open (fileName);
	}

	void
	close ()
	{
		m_dynamicLibrary.close ();
	}

	void*
	getFunction (const sl::StringRef& name)
	{
		return m_dynamicLibrary.getSymbol (name);
	}
};

#endif

//..............................................................................

} // namespace sys
} // namespace axl<commit_msg>[axl_sys] added DynamicLibrary::detach () method<commit_after>//..............................................................................
//
//  This file is part of the AXL library.
//
//  AXL is distributed under the MIT license.
//  For details see accompanying license.txt file,
//  the public copy of which is also available at:
//  http://tibbo.com/downloads/archive/axl/license.txt
//
//..............................................................................

#pragma once

#define _AXL_SYS_DYNAMICLIBRARY_H

#include "axl_g_Pch.h"

#if (_AXL_OS_WIN)
#	include "axl_sys_win_Library.h"
#	include "axl_sl_String.h"
#elif (_AXL_OS_POSIX)
#	include "axl_sys_psx_DynamicLibrary.h"
#endif

namespace axl {
namespace sys {

//..............................................................................

#if (_AXL_OS_WIN)

class DynamicLibrary
{
protected:
	win::Library m_library;

public:
	bool
	open (const sl::StringRef& fileName)
	{
		char buffer [256];
		sl::String_w fileName_w (ref::BufKind_Stack, buffer, sizeof (buffer));
		fileName_w = fileName;

		return m_library.loadLibrary (fileName_w);
	}

	void
	close ()
	{
		m_library.close ();
	}

	void
	detach ()
	{
		m_library.detach ();
	}

	void*
	getFunction (const sl::StringRef& name)
	{
		return m_library.getProcAddress (name);
	}
};

//..............................................................................

#elif (_AXL_OS_POSIX)

class DynamicLibrary
{
protected:
	psx::DynamicLibrary m_library;

public:
	bool
	open (const sl::StringRef& fileName)
	{
		return m_library.open (fileName);
	}

	void
	close ()
	{
		m_library.close ();
	}

	void
	detach ()
	{
		m_library.detach ();
	}

	void*
	getFunction (const sl::StringRef& name)
	{
		return m_library.getSymbol (name);
	}
};

#endif

//..............................................................................

} // namespace sys
} // namespace axl
{'fraction_non_alphanumeric': 0.31353403851369677, 'fraction_numerical': 0.0016273393002441008, 'mean_word_length': 1.6628158844765344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7637379', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1150, 'n_words': 254}