当前位置: 首页>>代码示例>>C++>>正文


C++ NSLookupSymbolInModule函数代码示例

本文整理汇总了C++中NSLookupSymbolInModule函数的典型用法代码示例。如果您正苦于以下问题:C++ NSLookupSymbolInModule函数的具体用法?C++ NSLookupSymbolInModule怎么用?C++ NSLookupSymbolInModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NSLookupSymbolInModule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NSLookupSymbolInModule

static void *dlsym(void *handle, char *function)
{
  NSSymbol symbol =
    NSLookupSymbolInModule(((struct pike_dl_handle *)handle)->module,
			   function);
  return symbol?NSAddressOfSymbol(symbol):NULL;
}
开发者ID:ajinkya007,项目名称:pike-1,代码行数:7,代码来源:dynamic_load.c

示例2: NSLookupAndBindSymbol

/* used by dlsym to find the symbol */
void *dlsymIntern(void *handle, const char *symbol)
{
  NSSymbol nssym = NULL;
  if (handle == (void *)-1)
  { /* Global context */
    if (NSIsSymbolNameDefined(symbol))
      nssym = NSLookupAndBindSymbol(symbol);
  }
  else
  {
    if (is_mach_header(handle))
    { /* library */
      if (NSIsSymbolNameDefinedInImage((struct mach_header *)handle, symbol))
        nssym = NSLookupSymbolInImage((struct mach_header *)handle, symbol,
                        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
                        | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
    }
    else /* bundle */
      nssym = NSLookupSymbolInModule((NSModule)handle, symbol);
  }
  if (!nssym)
  {
    error(0, "Symbol \"%s\" Not found", symbol);
    return NULL;
  }
  return NSAddressOfSymbol(nssym);
}
开发者ID:jkeuffer,项目名称:pari,代码行数:28,代码来源:darwin.c

示例3: NSLookupSymbolInModule

void *dlsym(void *myModule, char *mySymbolName)
{
  NSSymbol mySymbol;

  mySymbol = NSLookupSymbolInModule((NSModule)myModule, mySymbolName);
  return NSAddressOfSymbol(mySymbol);
}
开发者ID:mishan,项目名称:thinksynth,代码行数:7,代码来源:nsmodule_dl.cpp

示例4: NSLookupSymbolInImage

static void *GetSymbol(void *handle, const char *symbol)
{
	NSSymbol sym;

	/* We have to use a different lookup approach for images and modules */
	if((((struct mach_header *)handle)->magic == MH_MAGIC) ||
	   (((struct mach_header *)handle)->magic == MH_CIGAM))
	{
		if(NSIsSymbolNameDefinedInImage((struct mach_header *)handle, symbol))
		{
			sym = NSLookupSymbolInImage((struct mach_header *)handle, symbol,
						NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
						NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
		}
		else
		{
			sym = 0;
		}
	}
	else
	{
		sym = NSLookupSymbolInModule((NSModule)handle, symbol);
	}

	/* Did we find the symbol? */
	if(sym == 0)
	{
		return 0;
	}

	/* Convert the symbol into the address that we require */
	return (void *)NSAddressOfSymbol(sym);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:dynlib.c

示例5: switch

/* ggDarwinDLSym implements a "dlsym" wrapper
 */
void *ggDarwinDLSym(gg_dlhand handle, const char *symbol)
{
	void *nsaddr = NULL;
	NSSymbol nssymbol = 0;
	struct gg_dlhand_darwin_t *darwin_module;

	darwin_module = (struct gg_dlhand_darwin_t *)handle;

	switch (darwin_module->nsmodule_flags) {
	case NSLINKMODULE_OPTION_NONE:
		nssymbol = NSLookupAndBindSymbol(symbol);
		break;

	case NSLINKMODULE_OPTION_PRIVATE:
		nssymbol = NSLookupSymbolInModule(darwin_module->nsmodule,
				symbol);
		break;

	}	/* switch */

	nsaddr = NSAddressOfSymbol(nssymbol);

	/* no error handling needed here. The error handlers
	 * are called, when an error occurs.
	 */

	return nsaddr;
}	/* ggDarwinDLSym */
开发者ID:Nekrofage,项目名称:DoomRPi,代码行数:30,代码来源:dl_darwin.c

示例6: getmachosym

void*
getmachosym(NSModule library, const char* symname)
{
    NSSymbol    sym = NSLookupSymbolInModule(library, symname);
    if(sym)
        return NSAddressOfSymbol(sym);
    return 0;
}
开发者ID:martindemello,项目名称:felix,代码行数:8,代码来源:flx_dynlink.cpp

示例7: ll_sym

static lua_CFunction ll_sym (lua_State *L, void* lib, const char* sym) {
  NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym);
  if (nss == nullptr) {
    lua_pushfstring(L, "symbol " LUA_QS " not found", sym);
    return nullptr;
  }
  return (lua_CFunction)NSAddressOfSymbol(nss);
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:8,代码来源:loadlib.cpp

示例8: dyld_dlsym

static void * dyld_dlsym(void * hand, const char * name)
{
        NSSymbol sym=NSLookupSymbolInModule((NSModule)hand, name);
	void * addr = NULL;
	dyld_error_set=0;
	if (sym) addr=(void*)NSAddressOfSymbol(sym);
	if (!addr) dyld_error_set=1;
        return addr;
}
开发者ID:cention-nazri,项目名称:libdbi,代码行数:9,代码来源:dbi_main.c

示例9: find_sym_addr

 static void*
find_sym_addr(NS_pair *p, const char *name)
{
	NSSymbol nss;

	if (nss = NSLookupSymbolInModule(p->m, name))
		return NSAddressOfSymbol(nss);
	return 0;
	}
开发者ID:BRAINSia,项目名称:calatk,代码行数:9,代码来源:funcadd1.c

示例10: caml_dlsym

void * caml_dlsym(void * handle, char * name)
{
  NSSymbol sym;
  char _name[1000] = "_";
  strncat (_name, name, 998);
  dlerror_string = NULL;
  sym = NSLookupSymbolInModule((NSModule)handle, _name);
  if (sym != NULL) return NSAddressOfSymbol(sym);
  else return NULL;
}
开发者ID:avsm,项目名称:ocaml-community,代码行数:10,代码来源:unix.c

示例11: str_len

void *dlsym(void *handle, const char *symbol)
{
	int sym_len = str_len(symbol);
	void *value = NULL;
	char *malloc_sym = NULL;
	NSSymbol *nssym = 0;
	malloc_sym = malloc(sym_len + 2);
	if (malloc_sym)
	{
		sprintf(malloc_sym, "_%s", symbol);
		/* If the handle is -1, if is the app global context */
		if (handle == (void *)-1)
		{
			/* Global context, use NSLookupAndBindSymbol */
			if (NSIsSymbolNameDefined(malloc_sym))
			{
				nssym = NSLookupAndBindSymbol(malloc_sym);
			}
		}
		/* Now see if the handle is a struch mach_header* or not, use NSLookupSymbol in image
		   for libraries, and NSLookupSymbolInModule for bundles */
		else
		{
			/* Check for both possible magic numbers depending on x86/ppc byte order */
			if ((((struct mach_header *)handle)->magic == MH_MAGIC) ||
				(((struct mach_header *)handle)->magic == MH_CIGAM))
			{
				if (NSIsSymbolNameDefinedInImage((struct mach_header *)handle, malloc_sym))
				{
					nssym = NSLookupSymbolInImage((struct mach_header *)handle,
												  malloc_sym,
												  NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
												  | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
				}

			}
			else
			{
				nssym = NSLookupSymbolInModule(handle, malloc_sym);
			}
		}
		if (!nssym)
		{
			error(0, "Symbol \"%s\" Not found", symbol);
		}
		value = NSAddressOfSymbol(nssym);
		free(malloc_sym);
	}
	else
	{
		error(-1, "Unable to allocate memory");
	}
	return value;
}
开发者ID:darcyg,项目名称:chaosircd,代码行数:54,代码来源:dlfcn_darwin.c

示例12: snprintf

static void *dlsym(void *handle, const char *symbol)
{
  char		_symbol[256];
  NSSymbol	*nsSymbol= 0;

  snprintf(_symbol, sizeof(_symbol), "_%s", symbol);

  dprintf((stderr, "dlsym: looking for %s (%s) in %d\n", symbol, _symbol, (int)handle));

  if (!handle)
    {
      dprintf((stderr, "dlsym: setting app context for this handle\n"));
      handle= DL_APP_CONTEXT;
    }

  if (DL_APP_CONTEXT == handle)
    {
      dprintf((stderr, "dlsym: looking in app context\n"));
      if (NSIsSymbolNameDefined(_symbol))
	nsSymbol= NSLookupAndBindSymbol(_symbol);
    }
  else
    {
      if ((  (MH_MAGIC == ((struct mach_header *)handle)->magic))	/* ppc */
	  || (MH_CIGAM == ((struct mach_header *)handle)->magic))	/* 386 */
	{
	  if (NSIsSymbolNameDefinedInImage((struct mach_header *)handle, _symbol))
	    {
	      nsSymbol= NSLookupSymbolInImage
		((struct mach_header *)handle,
		 _symbol,
		 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
		 /*| NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR*/);
	      dprintf((stderr, "dlsym: bundle (image) lookup returned %p\n", nsSymbol));
	    }
	  else
	    dprintf((stderr, "dlsym: bundle (image) symbol not defined\n"));
	}
      else
	{
	  nsSymbol= NSLookupSymbolInModule(handle, _symbol);
	  dprintf((stderr, "dlsym: dylib (module) lookup returned %p\n", nsSymbol));
	}
    }

  if (!nsSymbol)
    {
      dlSetError("symbol not found: %s", _symbol);
      return 0;
    }

  return NSAddressOfSymbol(nsSymbol);
}
开发者ID:Adorkable-forkable,项目名称:Scratch.app.for.iOS,代码行数:53,代码来源:dlfcn-dyld.c

示例13: buf

static void *wx_darwin_dlsym(void *handle, const char *symbol)
{
    // as on many other systems, C symbols have prepended underscores under
    // Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
    // aware of this
    wxCharBuffer buf(strlen(symbol) + 1);
    char *p = buf.data();
    p[0] = '_';
    strcpy(p + 1, symbol);

    NSSymbol nsSymbol = NSLookupSymbolInModule((NSModule)handle, p );
    return nsSymbol ? NSAddressOfSymbol(nsSymbol) : NULL;
}
开发者ID:beanhome,项目名称:dev,代码行数:13,代码来源:dlunix.cpp

示例14: strcpy

void *vmddlsym( void *handle, const char *symname ) {
    char *realsymname;
    NSModule module;
    NSSymbol sym;
    /* Hack around the leading underscore in the symbol name */
    realsymname = (char *)malloc(strlen(symname)+2);
    strcpy(realsymname, "_");
    strcat(realsymname, symname);
    module = (NSModule)handle;
    sym = NSLookupSymbolInModule(module, realsymname);
    free(realsymname);
    if (sym)
        return (void *)(NSAddressOfSymbol(sym));
    return NULL;
}
开发者ID:yupinov,项目名称:gromacs,代码行数:15,代码来源:vmddlopen.c

示例15: findSharedSymbol

int 
findSharedSymbol (void *object, const char *symbol, void *pointerAddress) {
  NSModule module = object;
  char name[strlen(symbol) + 2];
  snprintf(name, sizeof(name), "_%s", symbol);
  {
    NSSymbol sym = NSLookupSymbolInModule(module, name);
    if (sym) {
      void **address = pointerAddress;
      *address = NSAddressOfSymbol(sym);
      return 1;
    }
  }
  return 0;
}
开发者ID:mlang,项目名称:brltty,代码行数:15,代码来源:dynld_dyld.c


注:本文中的NSLookupSymbolInModule函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。