#ifdef SHLIB
#include "shlib.h"
#endif
#import <stdio.h>
#import "stuff/bool.h"
#import <mach-o/dyld.h>
#import "ofi.h"
NSModule
NSLinkModule(
NSObjectFileImage objectFileImage,
const char *moduleName,
unsigned long options)
{
static NSModule (*p)(char *object_addr,
unsigned long object_size,
const char *moduleName,
unsigned long options) = NULL;
struct ofi *ofi;
ofi = (struct ofi *)objectFileImage;
if(p == NULL)
_dyld_func_lookup("__dyld_link_module", (unsigned long *)&p);
return(p(ofi->ofile.object_addr, ofi->ofile.object_size, moduleName,
options));
}
void
NSLinkEditError(
NSLinkEditErrors *c,
int *errorNumber,
const char **fileName,
const char **errorString)
{
static void (*p)(NSLinkEditErrors *c,
int *errorNumber,
const char **fileName,
const char **errorString) = NULL;
if(p == NULL)
_dyld_func_lookup("__dyld_link_edit_error", (unsigned long *)&p);
if(p != NULL)
p(c, errorNumber, fileName, errorString);
}
enum bool
NSUnLinkModule(
NSModule module,
unsigned long options)
{
static enum bool (*p)(NSModule module,
unsigned long options) = NULL;
if(p == NULL){
_dyld_func_lookup("__dyld_unlink_module", (unsigned long *)&p);
}
if(p != NULL){
return(p(module, options));
}
else{
return(FALSE);
}
}
NSModule
NSReplaceModule(
NSModule moduleToReplace,
NSObjectFileImage newObjectFileImage,
unsigned long options)
{
return(NULL);
}