[Scummvm-cvs-logs] SF.net SVN: scummvm:[51775] scummvm/branches/gsoc2010-plugins/backends/ plugins
toneman1138 at users.sourceforge.net
toneman1138 at users.sourceforge.net
Fri Aug 6 03:36:47 CEST 2010
Revision: 51775
http://scummvm.svn.sourceforge.net/scummvm/?rev=51775&view=rev
Author: toneman1138
Date: 2010-08-06 01:36:47 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
hacky way to put ELFPlugin::findSymbol in elf-provider.cpp without compiler errors
Modified Paths:
--------------
scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp
scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.h
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp 2010-08-06 00:11:27 UTC (rev 51774)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp 2010-08-06 01:36:47 UTC (rev 51775)
@@ -31,6 +31,33 @@
#if defined(DYNAMIC_MODULES) && defined(ELF_LOADER_TARGET)
+void (* ELFPlugin::findSymbol(const char *symbol))() {
+ void *func;
+ bool handleNull;
+ if (_dlHandle == NULL) {
+ func = NULL;
+ handleNull = true;
+ } else {
+ func = _dlHandle->symbol(symbol);
+ }
+ if (!func) {
+ if (handleNull) {
+ warning("Failed loading symbol '%s' from plugin '%s' (Handle is NULL)", symbol, _filename.c_str());
+ } else {
+ warning("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
+ }
+ }
+
+ // FIXME HACK: This is a HACK to circumvent a clash between the ISO C++
+ // standard and POSIX: ISO C++ disallows casting between function pointers
+ // and data pointers, but dlsym always returns a void pointer. For details,
+ // see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>.
+ assert(sizeof(VoidFunc) == sizeof(func));
+ VoidFunc tmp;
+ memcpy(&tmp, &func, sizeof(VoidFunc));
+ return tmp;
+}
+
bool ELFPlugin::loadPlugin() {
assert(!_dlHandle);
DLObject *obj = new DLObject(NULL);
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.h 2010-08-06 00:11:27 UTC (rev 51774)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.h 2010-08-06 01:36:47 UTC (rev 51775)
@@ -39,35 +39,8 @@
DLObject *_dlHandle;
Common::String _filename;
- //FIXME: The code for this method should be in elf-provider.cpp,
- // but VoidFunc isn't recognized if we do that as is.
- virtual VoidFunc findSymbol(const char *symbol) {
- void *func;
- bool handleNull;
- if (_dlHandle == NULL) {
- func = NULL;
- handleNull = true;
- } else {
- func = _dlHandle->symbol(symbol);
- }
- if (!func) {
- if (handleNull) {
- warning("Failed loading symbol '%s' from plugin '%s' (Handle is NULL)", symbol, _filename.c_str());
- } else {
- warning("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
- }
- }
+ virtual VoidFunc findSymbol(const char *symbol);
- // FIXME HACK: This is a HACK to circumvent a clash between the ISO C++
- // standard and POSIX: ISO C++ disallows casting between function pointers
- // and data pointers, but dlsym always returns a void pointer. For details,
- // see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>.
- assert(sizeof(VoidFunc) == sizeof(func));
- VoidFunc tmp;
- memcpy(&tmp, &func, sizeof(VoidFunc));
- return tmp;;
- }
-
public:
ELFPlugin(const Common::String &filename)
: _dlHandle(0), _filename(filename) {}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list