Merge remote-tracking branch 'lethosor/plugload-posix'

develop
lethosor 2015-01-05 16:50:43 -05:00
commit 182f317fcc
3 changed files with 5 additions and 49 deletions

@ -87,15 +87,15 @@ ENDIF()
SET(MAIN_SOURCES_LINUX SET(MAIN_SOURCES_LINUX
Console-posix.cpp Console-posix.cpp
Hooks-linux.cpp Hooks-linux.cpp
PlugLoad-linux.cpp PlugLoad-posix.cpp
Process-linux.cpp Process-linux.cpp
) )
SET(MAIN_SOURCES_DARWIN SET(MAIN_SOURCES_DARWIN
Console-posix.cpp Console-posix.cpp
PlugLoad-darwin.cpp
Process-darwin.cpp
Hooks-darwin.cpp Hooks-darwin.cpp
PlugLoad-posix.cpp
Process-darwin.cpp
) )
SET(MAIN_SOURCES_LINUX_EGGY SET(MAIN_SOURCES_LINUX_EGGY

@ -1,44 +0,0 @@
#include <stdio.h>
#include <dlfcn.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <vector>
#include <string>
#include <map>
#include "DFHack.h"
#include "PluginManager.h"
#include "Hooks.h"
#include <iostream>
/*
* Plugin loading functions
*/
namespace DFHack
{
DFLibrary * OpenPlugin (const char * filename)
{
dlerror();
DFLibrary * ret = (DFLibrary *) dlopen(filename, RTLD_NOW);
if(!ret)
{
std::cerr << dlerror() << std::endl;
}
return ret;
}
void * LookupPlugin (DFLibrary * plugin ,const char * function)
{
return (DFLibrary *) dlsym((void *)plugin, function);
}
void ClosePlugin (DFLibrary * plugin)
{
dlclose((void *) plugin);
}
}

@ -35,10 +35,10 @@ namespace DFHack
} }
void * LookupPlugin (DFLibrary * plugin ,const char * function) void * LookupPlugin (DFLibrary * plugin ,const char * function)
{ {
return (DFLibrary *) dlsym((void *)plugin, function); return (void *) dlsym((void *)plugin, function);
} }
void ClosePlugin (DFLibrary * plugin) void ClosePlugin (DFLibrary * plugin)
{ {
dlclose((void *) plugin); dlclose((void *) plugin);
} }
} }