Merge PlugLoad-linux.cpp and PlugLoad-darwin.cpp

develop
lethosor 2014-12-29 10:31:12 -05:00
parent 5fc8a1f51f
commit e0a8cc8537
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,7 +35,7 @@ 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)
{ {