• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ shl_findsym函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: return

DynamicLibrary::LIBRARY_SYMBOL DynamicLibrary::getSymbol(const String & symbolName)
{
    LIBRARY_SYMBOL func = 0;

    if(isLoaded())
    {
        CString cstr = symbolName.getCString();

        if(shl_findsym((shl_t *)&_handle, cstr, TYPE_UNDEFINED, &func) == 0)
        {
            return(func);
        }

        // NOTE: should the underscore be prepended by the caller or should
        // this be a compile time option?

        cstr = String(String("_") + symbolName).getCString();

        if(shl_findsym((shl_t *)_handle, cstr, TYPE_UNDEFINED, &func) == 0)
        {
            return(func);
        }
    }

    return(0);
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:26,代码来源:DynamicLibraryHPUX.cpp


示例2: defined

void*   OSCodeFragment::GetSymbol(const char* inSymbolName)
{
    if (fFragmentP == NULL)
        return NULL;
        
#if defined(HPUX) || defined(HPUX10)
    void *symaddr = NULL;
    int status;

    errno = 0;
    status = shl_findsym((shl_t *)&fFragmentP, symname, TYPE_PROCEDURE, &symaddr);
    if (status == -1 && errno == 0) /* try TYPE_DATA instead */
        status = shl_findsym((shl_t *)&fFragmentP, inSymbolName, TYPE_DATA, &symaddr);
    return (status == -1 ? NULL : symaddr);
#elif defined(DLSYM_NEEDS_UNDERSCORE)
    char *symbol = (char*)malloc(sizeof(char)*(strlen(inSymbolName)+2));
    void *retval;
    qtss_sprintf(symbol, "_%s", inSymbolName);
    retval = dlsym(fFragmentP, symbol);
    free(symbol);
    return retval;
#elif defined(__Win32__)
    return ::GetProcAddress(fFragmentP, inSymbolName);
#elif defined(__MacOSX__)
    CFStringRef theString = CFStringCreateWithCString( kCFAllocatorDefault, inSymbolName, kCFStringEncodingASCII);
    void* theSymbol = (void*)CFBundleGetFunctionPointerForName( fFragmentP, theString );
    CFRelease(theString);
    return theSymbol;
#else
    return dlsym(fFragmentP, inSymbolName);
#endif  
}
开发者ID:12307,项目名称:EasyDarwin,代码行数:32,代码来源:OSCodeFragment.cpp


示例3: TclpFindSymbol

Tcl_PackageInitProc *
TclpFindSymbol(
    Tcl_Interp *interp,
    Tcl_LoadHandle loadHandle,
    CONST char *symbol)
{
    Tcl_DString newName;
    Tcl_PackageInitProc *proc = NULL;
    shl_t handle = (shl_t)loadHandle;

    /*
     * Some versions of the HP system software still use "_" at the beginning
     * of exported symbols while others don't; try both forms of each name.
     */

    if (shl_findsym(&handle, symbol, (short) TYPE_PROCEDURE,
	    (void *) &proc) != 0) {
	Tcl_DStringInit(&newName);
	Tcl_DStringAppend(&newName, "_", 1);
	Tcl_DStringAppend(&newName, symbol, -1);
	if (shl_findsym(&handle, Tcl_DStringValue(&newName),
		(short) TYPE_PROCEDURE, (void *) &proc) != 0) {
	    proc = NULL;
	}
	Tcl_DStringFree(&newName);
    }
    return proc;
}
开发者ID:AbaqusPowerUsers,项目名称:AbaqusPythonScripts,代码行数:28,代码来源:tclLoadShl.c


示例4: xmlModulePlatformSymbol

static int
xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
{
    int rc;

    errno = 0;
    rc = shl_findsym(handle, name, TYPE_PROCEDURE, symbol);
    if ((-1 == rc) && (0 == errno)) {
        rc = shl_findsym(handle, name, TYPE_DATA, symbol);
    }
    return rc;
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:12,代码来源:xmlmodule.c


示例5: main

int main ()
{
  shl_t  solib_handle;
  int  dummy;
  int  status;
  int  (*solib_main) (int);

  /* Load a shlib, with immediate binding of all symbols.

     Note that the pathname of the loaded shlib is assumed to be relative
     to the testsuite directory (from whence the tested GDB is run), not
     from dot/.
   */
  dummy = 1;  /* Put some code between shl_ calls... */
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);

  /* Find a function within the shlib, and call it. */
  status = shl_findsym (&solib_handle,
                        "solib_main",
                        TYPE_PROCEDURE,
                        (long *) &solib_main);
  status = (*solib_main) (dummy);

  /* Unload the shlib. */
  status = shl_unload (solib_handle);

  /* Load a different shlib, with deferred binding of all symbols. */
  dummy = 2;
  solib_handle = shl_load ("gdb.base/solib2.sl", BIND_DEFERRED, 0);

  /* Find a function within the shlib, and call it. */
  status = shl_findsym (&solib_handle,
                        "solib_main",
                        TYPE_PROCEDURE,
                        (long *) &solib_main);
  status = (*solib_main) (dummy);

  /* Unload the shlib. */
  status = shl_unload (solib_handle);

  /* Reload the first shlib again, with deferred symbol binding this time. */
  dummy = 3;
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);

  /* Unload it without trying to find any symbols in it. */
  status = shl_unload (solib_handle);

  /* All done. */
  dummy = -1;
  return 0;
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:51,代码来源:solib.c


示例6: defined

GError GPlugLoader::ResolveSymbol(const GChar8 *SymbolName, GPlugSymbolAddress *ResolvedSymbol) const {

	void *result = NULL;

	if ((!SymbolName) || (!ResolvedSymbol))
		return G_INVALID_PARAMETER;
    if (!gPlugHandle)
		return G_PLUGIN_NOTLOADED;
	#if defined(G_OS_WIN) && !defined(__CYGWIN__)
		result = (GPlugSymbolAddress)GetProcAddress((HMODULE)gPlugHandle, SymbolName);
		if (!result)
			return G_PLUGIN_SYMBOL_UNRESOLVED;
		*ResolvedSymbol = result;
		return G_NO_ERROR;
	#elif defined(G_OS_HPUX)
		if (shl_findsym (reinterpret_cast<shl_t*>(&gPlugHandle), SymbolName, TYPE_PROCEDURE, result) == 0) {
			*ResolvedSymbol = result;
			return G_NO_ERROR;
		}
		return G_PLUGIN_SYMBOL_UNRESOLVED;
	#else // other unix (it works also on MacOSX and Tiger)
		result = dlsym(gPlugHandle,  SymbolName);
		if (!result)
			return G_PLUGIN_SYMBOL_UNRESOLVED;
		*ResolvedSymbol = result;
		return G_NO_ERROR;
	#endif
}
开发者ID:BackupTheBerlios,项目名称:amanith-svn,代码行数:28,代码来源:gpluglib.cpp


示例7:

void *vmddlsym( void *handle, const char *sym ) {
    void *value=0;

    if ( shl_findsym( (shl_t*)&handle, sym, TYPE_UNDEFINED, &value ) != 0 )
        return 0;
    return value;
}
开发者ID:yupinov,项目名称:gromacs,代码行数:7,代码来源:vmddlopen.c


示例8: shl_findsym

static void *dl_globallookup(const char *name)
{
    void *ret;
    shl_t h = NULL;

    return shl_findsym(&h, name, TYPE_UNDEFINED, &ret) ? NULL : ret;
}
开发者ID:1564143452,项目名称:kbengine,代码行数:7,代码来源:dso_dl.c


示例9: dll_entrypoint

//==========================================================================================
static DLL_EP dll_entrypoint( DLL *dll, const char *name )
{
#if defined(_WIN32) || defined(WIN32) || defined(__WIN32__)
    
    FARPROC proc;
    
    proc = GetProcAddress( (HMODULE) dll, (LPCSTR) name );
    if( proc == NULL )
    {
        printf( "Failed to load %s. Error code %d\n", name, GetLastError() );
    }
    return (DLL_EP) proc;
    
#else // UNIX

#if defined LINUX  || defined SUN || defined MACOSX
	void *handle = (void *) dll;
	DLL_EP ep;
	ep = (DLL_EP) dlsym(handle, name);
	return ( dlerror() == 0 ) ? ep : (DLL_EP) NULL;

#elif defined HP || defined HPUX
	shl_t handle = (shl_t) dll;
	DLL_EP ep;
	return shl_findsym(&handle, name, TYPE_PROCEDURE, &ep) == -1 ?
		(DLL_EP) NULL : ep;
#else

	void *handle = (void *) dll;
	DLL_EP ep;
	ep = (DLL_EP) dlsym(handle, name);
	return ( dlerror() == 0 ) ? ep : (DLL_EP) NULL;
#endif
#endif
}	
开发者ID:sndae,项目名称:winter-sense,代码行数:36,代码来源:isense.c


示例10: FindProcedure

/**************************************************************************
 * Name: FindProcedure
 *
 * Description: Mapping functions to the matching one in libsend_to_ths library.
 *
 * Inputs:  procedure name
 *          Address of the mapping procedure
 * Outputs: None
 *
 * Returns:	SUUCESS/FAILURE
 ************************************************************************* */
int FindProcedure(const char* procedure, void* libPointer, void** procAddress, char* errstr)
{
   int err = 0;
   char procedure_err[128];
   *procAddress = NULL;
#if defined(WIN32)
   *procAddress = GetProcAddress( (HINSTANCE)libPointer, procedure);
#elif defined(SOLARIS) || defined(OSF1) || defined(HPUX_64) || defined(_AIX) || defined(LINUX)
   *procAddress = dlsym( libPointer, procedure);
#elif defined(HPUX)
  err = shl_findsym( (shl_t *)&libPointer, procedure, TYPE_PROCEDURE, procAddress);
  if ( err != 0)
  {
     *procAddress = NULL;
  }
#else
#error THSlibLoader not defined for this platform you must define it now FindProcedure
#endif
   if (NULL == *procAddress)
   {
      sprintf(procedure_err, "Could not load procedure %s, Please check your library ...", procedure);
      strcpy(errstr, procedure_err);
      /* emit(SHLIB_ERRLOC, MPS_GENERIC_DEBUG, procedure_err); */
      return FAILURE;
   }
   return SUCCESS; 
}
开发者ID:huilang22,项目名称:Projects,代码行数:38,代码来源:shlib_loader.c


示例11: find_c_function

/* Look for an object with the given name in the named file and return a
   callable "<c-function>" object for it. */
obj_t find_c_function(obj_t /* <string> */ symbol, obj_t lookup)
{
    const char *string = string_chars(symbol);
    struct symtab *syms;
    int sym_count, i;
    obj_t retval = obj_False;

    if (lookup == obj_Unbound) {
        if (mindy_dynamic_syms == NULL)
            mindy_dynamic_syms = load_program_file();
        return find_c_function(symbol, mindy_dynamic_syms);
    } else if (lookup == obj_False)
        return obj_False;
    else if (!instancep(lookup, obj_ForeignFileClass)) {
        error("Keyword file: is not a <foreign-file>: %=", lookup);
        return retval;                /* make lint happy */
    } else if (instancep(lookup, obj_SharedFileClass)) {
        shl_t *files = obj_ptr(struct shared_file *, lookup)->handles;
        int file_count = obj_ptr(struct shared_file *, lookup)->file_count;
        void *ptr;

        for (i = 0; i < file_count; i++)
            if (shl_findsym(&files[i], string, &ptr) == 0)
                return(make_c_function(make_byte_string(string), ptr));
        return retval;
    } else {
开发者ID:krytarowski,项目名称:mindy,代码行数:28,代码来源:extern.c


示例12: _g_module_symbol

static gpointer
_g_module_symbol (gpointer     handle,
                  const gchar *symbol_name)
{
    gpointer p = NULL;

    /* should we restrict lookups to TYPE_PROCEDURE?
     */
    if (handle == PROG_HANDLE)
    {
        /* PROG_HANDLE will only lookup symbols in the program itself, not honouring
         * libraries. passing NULL as a handle will also try to lookup the symbol
         * in currently loaded libraries. fix pointed out and supplied by:
         * David Gero <[email protected]>
         */
        handle = NULL;
    }
    if (shl_findsym ((shl_t*) &handle, symbol_name, TYPE_UNDEFINED, &p) != 0 ||
            handle == NULL || p == NULL)
    {
        /* the hp-docs say we should better abort() if errno==ENOSYM ;( */
        g_module_set_error (g_strerror (errno));
    }

    return p;
}
开发者ID:01org,项目名称:android-bluez-glib,代码行数:26,代码来源:gmodule-dld.c


示例13: _PyImport_GetDynLoadFunc

dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
				    const char *pathname, FILE *fp)
{
	dl_funcptr p;
	shl_t lib;
	int flags;
	char funcname[258];

	flags = BIND_FIRST | BIND_DEFERRED;
	if (Py_VerboseFlag) {
		flags = DYNAMIC_PATH | BIND_FIRST | BIND_IMMEDIATE |
			BIND_NONFATAL | BIND_VERBOSE;
		printf("shl_load %s\n",pathname);
	}
	lib = shl_load(pathname, flags, 0);
	/* XXX Chuck Blake once wrote that 0 should be BIND_NOSTART? */
	if (lib == NULL) {
		char buf[256];
		if (Py_VerboseFlag)
			perror(pathname);
		sprintf(buf, "Failed to load %.200s", pathname);
		PyErr_SetString(PyExc_ImportError, buf);
		return NULL;
	}
	sprintf(funcname, FUNCNAME_PATTERN, shortname);
	if (Py_VerboseFlag)
		printf("shl_findsym %s\n", funcname);
	shl_findsym(&lib, funcname, TYPE_UNDEFINED, (void *) &p);
	if (p == NULL && Py_VerboseFlag)
		perror(funcname);

	return p;
}
开发者ID:asottile,项目名称:ancient-pythons,代码行数:33,代码来源:dynload_hpux.c


示例14: dl_bind_func

static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
{
    shl_t ptr;
    void *sym;

    if ((dso == NULL) || (symname == NULL)) {
        DSOerr(DSO_F_DL_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER);
        return (NULL);
    }
    if (sk_num(dso->meth_data) < 1) {
        DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_STACK_ERROR);
        return (NULL);
    }
    ptr = (shl_t) sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
    if (ptr == NULL) {
        DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_NULL_HANDLE);
        return (NULL);
    }
    if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) {
        DSOerr(DSO_F_DL_BIND_FUNC, DSO_R_SYM_FAILURE);
        ERR_add_error_data(4, "symname(", symname, "): ", strerror(errno));
        return (NULL);
    }
    return ((DSO_FUNC_TYPE)sym);
}
开发者ID:1564143452,项目名称:kbengine,代码行数:25,代码来源:dso_dl.c


示例15: vm_open

/* A function called through the vtable to open a module with this
   loader.  Returns an opaque representation of the newly opened
   module for processing with this loader's other vtable functions.  */
static lt_module
vm_open (lt_user_data LT__UNUSED loader_data, const char *filename,
         lt_dladvise LT__UNUSED advise)
{
  static shl_t self = (shl_t) 0;
  lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L);

  /* Since searching for a symbol against a NULL module handle will also
     look in everything else that was already loaded and exported with
     the -E compiler flag, we always cache a handle saved before any
     modules are loaded.  */
  if (!self)
    {
      void *address;
      shl_findsym (&self, "main", TYPE_UNDEFINED, &address);
    }

  if (!filename)
    {
      module = self;
    }
  else
    {
      module = shl_load (filename, LT_BIND_FLAGS, 0L);

      if (!module)
	{
	  LT__SETERROR (CANNOT_OPEN);
	}
    }

  return module;
}
开发者ID:ILUZIO,项目名称:libtool,代码行数:36,代码来源:shl_load.c


示例16: DSOerr

static void *dl_bind_var(DSO *dso, const char *symname)
	{
	shl_t ptr;
	void *sym;

	if((dso == NULL) || (symname == NULL))
		{
		DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
		return(NULL);
		}
	if(sk_num(dso->meth_data) < 1)
		{
		DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR);
		return(NULL);
		}
	ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
	if(ptr == NULL)
		{
		DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE);
		return(NULL);
		}
	if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0)
		{
		DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE);
		return(NULL);
		}
	return(sym);
	}
开发者ID:aosm,项目名称:OpenSSL096,代码行数:28,代码来源:dso_dl.c


示例17: dlsym

void *
dlsym(void *handle, const char *name)
{
  void *p;

  shl_findsym((shl_t *) & handle, name, TYPE_UNDEFINED, &p);
  return p;
}
开发者ID:pquerna,项目名称:trafficserver,代码行数:8,代码来源:synth_server.c


示例18: dlsym

void *
dlsym(void *handle, const char *symbol)
{
	void	   *value;

	if (shl_findsym((shl_t *) & handle, symbol, TYPE_PROCEDURE, &value) == -1)
		return NULL;
	return value;
}
开发者ID:MasahikoSawada,项目名称:postgresql,代码行数:9,代码来源:dlopen.c


示例19: pg_dlsym

PGFunction
pg_dlsym(void *handle, char *funcname)
{
	PGFunction	f;

	if (shl_findsym((shl_t *) & handle, funcname, TYPE_PROCEDURE, &f) == -1)
		f = (PGFunction) NULL;
	return f;
}
开发者ID:BertrandAreal,项目名称:postgres,代码行数:9,代码来源:hpux.c


示例20:

void *dlsym(void *handle, const char *sym)
{
	shl_t h = (shl_t)handle;
	void *address;

	if (shl_findsym(&h, sym, TYPE_UNDEFINED, &address) == 0)
			return address;
	return NULL;
}
开发者ID:mistydemeo,项目名称:libmikmod,代码行数:9,代码来源:dl_hpux.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ shl_load函数代码示例发布时间:2022-05-30
下一篇:
C++ shl函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap