diff options
| author | Timothy Collett | 2012-05-25 14:28:59 -0400 |
|---|---|---|
| committer | Timothy Collett | 2012-05-25 14:28:59 -0400 |
| commit | 1dd4cc56670819e72d05c306d4f97d9b5a15cd3b (patch) | |
| tree | d9f65163e789733a36f37a3def3dd2c428dab9cf /library/PlugLoad-darwin.cpp | |
| parent | 44c3afc3066652f39d0b7be56cdca1f88e155132 (diff) | |
| download | dfhack-1dd4cc56670819e72d05c306d4f97d9b5a15cd3b.tar.gz dfhack-1dd4cc56670819e72d05c306d4f97d9b5a15cd3b.tar.bz2 dfhack-1dd4cc56670819e72d05c306d4f97d9b5a15cd3b.tar.xz | |
More work on getting dfhack building & compiling on Mac OS X
Diffstat (limited to 'library/PlugLoad-darwin.cpp')
| -rw-r--r-- | library/PlugLoad-darwin.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/library/PlugLoad-darwin.cpp b/library/PlugLoad-darwin.cpp new file mode 100644 index 00000000..69945c6f --- /dev/null +++ b/library/PlugLoad-darwin.cpp @@ -0,0 +1,44 @@ +#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); + } +}
\ No newline at end of file |
