sharedlib.h

来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 67 行

H
67
字号
/**
 * @file SharedLib.h
 * @brief shared library loader
 * @author Christopher Han <xiphux@gmail.com>
 *
 * Base shared library loading class definitiion
 * Copyright (C) 2005.  Licensed under the terms of the
 * GNU GPL, v2 or later.
 */
#ifndef SHAREDLIB_H
#define SHAREDLIB_H

#include <string>

#ifndef _WIN32
/**
 * @brief WINAPI define
 *
 * On non-windows, defines the WINAPI modifier used in
 * Windows DLLs to empty, so it'll ignore them
 */
#define WINAPI
#endif

/**
 * @brief shared library base
 *
 * This is the abstract shared library class used for
 * polymorphic loading.  Platform-specifics should
 * derive from this.
 */
class SharedLib
{
public:
	/**
	 * @brief instantiate
	 * @param filename file name as a C string
	 * @return platform-specific shared library class
	 */
	static SharedLib *Instantiate(const char *filename);

	/**
	 * @brief instantiate
	 * @param filename file name as a C++ string
	 * @return platform-specific shared library class
	 */
	static SharedLib *Instantiate(std::string filename);

	/**
	 * @brief GetLibExtension
	 * @return "dll", "dylib" or "so" depending on OS
	 */
	static const char *GetLibExtension();

	/**
	 * @brief Find Address
	 * @param symbol function name (symbol) to locate
	 *
	 * Abstract so it must be implemented specifically by all platforms.
	 */
	virtual void *FindAddress(const char *symbol) = 0;

	virtual ~SharedLib();
};

#endif /* SHAREDLIB_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?