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

C++ NSLinkModule函数代码示例

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

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



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

示例1: WXUNUSED

void *dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
{
    NSObjectFileImage ofile;
    NSModule handle = NULL;

    int dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
    if ( dyld_result != NSObjectFileImageSuccess )
    {
        handle = NULL;
    }
    else
    {
        handle = NSLinkModule
                 (
                    ofile,
                    path,
                    NSLINKMODULE_OPTION_BINDNOW |
                    NSLINKMODULE_OPTION_RETURN_ON_ERROR
                 );
    }

    if ( !handle )
        TranslateError(path, dyld_result);

    return handle;
}
开发者ID:project-renard-survey,项目名称:chandler,代码行数:26,代码来源:dlunix.cpp


示例2: NSInstallLinkEditErrorHandlers

void *dlopen(char *filename, int unused)
{
  NSObjectFileImage myImage;
  NSModule myModule;

  if (firstLoad)
  {
    /* If we are loading our first symbol (huzzah!) we should go ahead
     * and install link editor error handling!
     */
    NSLinkEditErrorHandlers linkEditorErrorHandlers;

    linkEditorErrorHandlers.undefined = undefinedErrorHandler;
    linkEditorErrorHandlers.multiple  = multipleErrorHandler;
    linkEditorErrorHandlers.linkEdit  = linkEditErrorHandler;
    NSInstallLinkEditErrorHandlers(&linkEditorErrorHandlers);
    firstLoad = FALSE;
  }

  myDlError = NSCreateObjectFileImageFromFile(filename, &myImage);

  if (myDlError != NSObjectFileImageSuccess)
    return(NULL);

  myModule = NSLinkModule(myImage, filename, NSLINKMODULE_OPTION_PRIVATE);
  return((void *)myModule);
}
开发者ID:mishan,项目名称:thinksynth,代码行数:27,代码来源:nsmodule_dl.cpp


示例3: dlinit

static void *dlopen(const char *path, int mode)
{
  void			*handle= 0;
  NSObjectFileImage	 ofi= 0;

  if (!dlInitialised)
    {
      dlinit();
      dlInitialised= 1;
    }

  if (!path)
    return DL_APP_CONTEXT;

  switch (NSCreateObjectFileImageFromFile(path, &ofi))
    {
    case NSObjectFileImageSuccess:
      handle= NSLinkModule(ofi, path, NSLINKMODULE_OPTION_RETURN_ON_ERROR);
      NSDestroyObjectFileImage(ofi);
      break;
    case NSObjectFileImageInappropriateFile:
      handle= (void *)NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
      break;
    default:
      handle= 0;
      break;
    }

  if (!handle)
    dlSetError("could not load shared object: %s", path);

  dprintf((stderr, "dlopen: %s => %d\n", path, (int)handle));

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


示例4: ggDarwinDLOpen

/* ggDarwinDLOpen implements a "dlopen" wrapper
 */
gg_dlhand ggDarwinDLOpen(const char *filename, int flags)
{
	gg_dlhand ret = NULL;
	struct gg_dlhand_darwin_t *darwin_ret = NULL;
	NSLinkEditErrorHandlers error_handlers;
	const char *pathname, *modulename;

	darwin_ret = (struct gg_dlhand_darwin_t *)malloc(sizeof(struct gg_dlhand_darwin_t));
	if (darwin_ret == NULL) return ret;

	ret = (void *)darwin_ret;

	if (flags & GG_MODULE_GLOBAL) {
		darwin_ret->nsmodule_flags = NSLINKMODULE_OPTION_NONE;
	} else {
		darwin_ret->nsmodule_flags = NSLINKMODULE_OPTION_PRIVATE;
	}	/* if */

	splitstring(filename, &pathname, &modulename);

	dlerror_code = NSCreateObjectFileImageFromFile(pathname, &darwin_ret->objectFileImage);
	ggstrlcpy(dlerror_filename, filename, sizeof(dlerror_filename));

	switch (dlerror_code) {
	case NSObjectFileImageSuccess:
		break;

	case NSObjectFileImageFailure:
	case NSObjectFileImageInappropriateFile:
	case NSObjectFileImageArch:
	case NSObjectFileImageFormat:
	case NSObjectFileImageAccess:
		goto err0;
	}	/* switch */

	/* Install our own error handlers */
	error_handlers.undefined = ggDarwinErrorUndefined;
	error_handlers.multiple = ggDarwinErrorMultiple;
	error_handlers.linkEdit = ggDarwinErrorLinkEdit;

#if 0
	/* Let the default handlers do their work
	 * as long as our own error handlers are stubs.
	 */
	NSInstallLinkEditErrorHandlers(&error_handlers);
#endif

	/* try to load the module now */
	darwin_ret->nsmodule = NSLinkModule(darwin_ret->objectFileImage,
					modulename, darwin_ret->nsmodule_flags);

	/* Either we return successful here or the error handlers
	 * already aborted/exited the app before.
	 */
	return ret;

err0:
	free(ret);
	return NULL;
}	/* ggDarwinDLOpen */
开发者ID:Nekrofage,项目名称:DoomRPi,代码行数:62,代码来源:dl_darwin.c


示例5: caml_dlopen

void * caml_dlopen(char * libname, int for_execution)
{
  NSObjectFileImage image;
  entry_t *bentry = caml_lookup_bundle(libname);
  NSObjectFileImageReturnCode retCode;
  void *result = NULL;

  if (bentry->count > 0)
    return bentry->handle;

  retCode = NSCreateObjectFileImageFromFile(libname, &image);
  switch (retCode) {
  case NSObjectFileImageSuccess:
    dlerror_string = NULL;
    result = (void*)NSLinkModule(image, libname, NSLINKMODULE_OPTION_BINDNOW
                                 | NSLINKMODULE_OPTION_RETURN_ON_ERROR);
    if (result != NULL) {
      bentry->count++;
      bentry->handle = result;
    }
    else NSDestroyObjectFileImage(image);
    break;
  case NSObjectFileImageAccess:
    dlerror_string = "cannot access this bundle"; break;
  case NSObjectFileImageArch:
    dlerror_string = "this bundle has wrong CPU architecture"; break;
  case NSObjectFileImageFormat:
  case NSObjectFileImageInappropriateFile:
    dlerror_string = "this file is not a proper bundle"; break;
  default:
    dlerror_string = "could not read object file"; break;
  }
  return result;
}
开发者ID:avsm,项目名称:ocaml-community,代码行数:34,代码来源:unix.c


示例6: pr_LoadMachDyldModule

static NSModule
pr_LoadMachDyldModule(const char *name)
{
    NSObjectFileImage ofi;
    NSModule h = NULL;
    if (NSCreateObjectFileImageFromFile(name, &ofi)
            == NSObjectFileImageSuccess) {
        h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE
                         | NSLINKMODULE_OPTION_RETURN_ON_ERROR);
        if (h == NULL) {
            NSLinkEditErrors linkEditError;
            int errorNum;
            const char *fileName;
            const char *errorString;
            NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
            PR_LOG(_pr_linker_lm, PR_LOG_MIN,
                   ("LoadMachDyldModule error %d:%d for file %s:\n%s",
                    linkEditError, errorNum, fileName, errorString));
        }
        if (NSDestroyObjectFileImage(ofi) == FALSE) {
            if (h) {
                (void)NSUnLinkModule(h, NSUNLINKMODULE_OPTION_NONE);
                h = NULL;
            }
        }
    }
    return h;
}
开发者ID:sahlberg,项目名称:timberwolf,代码行数:28,代码来源:prlink.c


示例7: loadSharedObject

void *
loadSharedObject (const char *path) {
  NSObjectFileImage image;
  switch (NSCreateObjectFileImageFromFile(path, &image)) {
    case NSObjectFileImageSuccess: {
      NSModule module = NSLinkModule(image, path, NSLINKMODULE_OPTION_RETURN_ON_ERROR);
      if (module) return module;
      logDyldError("link module");
      logMessage(LOG_ERR, "shared object not linked: %s", path);
      break;
    }

    case NSObjectFileImageInappropriateFile:
      logMessage(LOG_ERR, "inappropriate object type: %s", path);
      break;

    case NSObjectFileImageArch:
      logMessage(LOG_ERR, "incorrect object architecture: %s", path);
      break;

    case NSObjectFileImageFormat:
      logMessage(LOG_ERR, "invalid object format: %s", path);
      break;

    case NSObjectFileImageAccess:
      logMessage(LOG_ERR, "inaccessible object: %s", path);
      break;

    case NSObjectFileImageFailure:
    default:
      logMessage(LOG_ERR, "shared object not loaded: %s", path);
      break;
  }
  return NULL;
}
开发者ID:mlang,项目名称:brltty,代码行数:35,代码来源:dynld_dyld.c


示例8: int

/* dlopen */
void *darwin_dlopen(const char *path, int mode)
{
	void *module = 0;
	NSObjectFileImage ofi = 0;
	NSObjectFileImageReturnCode ofirc;
	static int (*make_private_module_public) (NSModule module) = 0;
	unsigned int flags =  NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE;
	sys::coreout << "darwin try bind module: "  << path << sys::eofl;
	/* If we got no path, the app wants the global namespace, use -1 as the marker
	   in this case */
	if (!path)
		return (void *)-1;

	/* Create the object file image, works for things linked with the -bundle arg to ld */
	ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
	switch (ofirc)
	{
		case NSObjectFileImageSuccess:
			/* It was okay, so use NSLinkModule to link in the image */
			if (!(mode & RTLD_LAZY)) flags += NSLINKMODULE_OPTION_BINDNOW;
			module = NSLinkModule(ofi, path,flags);
			sys::coreout << "darwin bind module: "  << path << sys::eofl;
			/* Don't forget to destroy the object file image, unless you like leaks */
			NSDestroyObjectFileImage(ofi);
			/* If the mode was global, then change the module, this avoids
			   multiply defined symbol errors to first load private then make
			   global. Silly, isn't it. */
			if ((mode & RTLD_GLOBAL))
			{
			  if (!make_private_module_public)
			  {
			    _dyld_func_lookup("__dyld_NSMakePrivateModulePublic", 
				(unsigned long *)&make_private_module_public);
			  }
			  make_private_module_public(module);
			}
			break;
		case NSObjectFileImageInappropriateFile:
			/* It may have been a dynamic library rather than a bundle, try to load it */
			module = (void *)NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
			sys::coreout << " wrong filetype use addimage: " << (void*)module << sys::eofl;
			break;
		case NSObjectFileImageFailure:
			error(0,"Object file setup failure :  \"%s\"", path);
			return 0;
		case NSObjectFileImageArch:
			error(0,"No object for this architecture :  \"%s\"", path);
			return 0;
		case NSObjectFileImageFormat:
			error(0,"Bad object file format :  \"%s\"", path);
			return 0;
		case NSObjectFileImageAccess:
			error(0,"Can't read object file :  \"%s\"", path);
			return 0;		
	}
	if (!module)
		error(0, "Can not open \"%s\"", path);
	return module;
}
开发者ID:huangyt,项目名称:foundations.github.com,代码行数:60,代码来源:SharedLibrary.cpp


示例9: OW_LOG_DEBUG

SharedLibraryRef
dyldSharedLibraryLoader::loadSharedLibrary(const String& filename,
	const LoggerRef& logger) const
{
	OW_LOG_DEBUG(logger, Format("Load request for %1 received.", filename));
	NSObjectFileImage image = 0;
	NSObjectFileImageReturnCode dsoerr = NSCreateObjectFileImageFromFile(filename.c_str(), &image);
	const char* err_msg = NULL;
	NSModule libhandle = NULL;	

	if (dsoerr == NSObjectFileImageSuccess)
	{
		libhandle = NSLinkModule(image, filename.c_str(), NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE);		
		if (!libhandle)
		{
			NSLinkEditErrors errors;
			int errorNumber;
			const char *fileName;
			NSLinkEditError(&errors, &errorNumber, &fileName, &err_msg);
		}
		NSDestroyObjectFileImage(image);
	}
	else if ((dsoerr == NSObjectFileImageFormat ||
					dsoerr == NSObjectFileImageInappropriateFile) &&
					NSAddLibrary(filename.c_str()) == TRUE)
	{
		OW_LOG_ERROR(logger, Format("NSCreateObject: %1 failed with error \"%2\"",
														filename, dsoerr));
		// libhandle = (NSModule)DYLD_LIBRARY_HANDLE;
	}
	else
	{
		err_msg = "cannot create object file image or add library";
		OW_LOG_ERROR(logger, Format("NSCreateObject: %1 failed with error %2",
														filename, dsoerr));
	}



	if (libhandle)
	{
		try
		{
			return SharedLibraryRef( new dyldSharedLibrary(libhandle,
																										 filename));
		}
		catch (...)
		{
			NSUnLinkModule(libhandle, FALSE);
			throw;
		}
	}
	else
	{
		OW_LOG_ERROR(logger, Format("dyldSharedLibraryLoader::loadSharedLibrary:"
														" %1", err_msg));
		return SharedLibraryRef( 0 );
	}
}
开发者ID:kkaempf,项目名称:openwbem,代码行数:59,代码来源:OW_dyldSharedLibraryLoader.cpp


示例10: WXUNUSED

static void *wx_darwin_dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
{
    NSObjectFileImage ofile;
    NSModule handle = NULL;

    unsigned dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
    if ( dyld_result != NSObjectFileImageSuccess )
    {
        handle = NULL;

        static const char *const errorStrings[] =
        {
            "%d: Object Image Load Failure",
            "%d: Object Image Load Success",
            "%d: Not an recognisable object file",
            "%d: No valid architecture",
            "%d: Object image has an invalid format",
            "%d: Invalid access (permissions?)",
            "%d: Unknown error code from NSCreateObjectFileImageFromFile"
        };

        const int index = dyld_result < WXSIZEOF(errorStrings)
                            ? dyld_result
                            : WXSIZEOF(errorStrings) - 1;

        // this call to sprintf() is safe as strings above are fixed at
        // compile-time and are shorter than WXSIZEOF(dl_last_error)
        sprintf(dl_last_error, errorStrings[index], dyld_result);
    }
    else
    {
        handle = NSLinkModule
                 (
                    ofile,
                    path,
                    NSLINKMODULE_OPTION_BINDNOW |
                    NSLINKMODULE_OPTION_RETURN_ON_ERROR
                 );

        if ( !handle )
        {
            NSLinkEditErrors err;
            int code;
            const char *filename;
            const char *errmsg;

            NSLinkEditError(&err, &code, &filename, &errmsg);
            strncpy(dl_last_error, errmsg, WXSIZEOF(dl_last_error)-1);
            dl_last_error[WXSIZEOF(dl_last_error)-1] = '\0';
        }
    }


    return handle;
}
开发者ID:beanhome,项目名称:dev,代码行数:55,代码来源:dlunix.cpp


示例11: pg_dlopen

void *
pg_dlopen(char *filename)
{
	NSObjectFileImage image;

	cofiff_result = NSCreateObjectFileImageFromFile(filename, &image);
	if (cofiff_result != NSObjectFileImageSuccess)
		return NULL;
	return NSLinkModule(image, filename,
						NSLINKMODULE_OPTION_BINDNOW |
						NSLINKMODULE_OPTION_RETURN_ON_ERROR);
}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:12,代码来源:darwin.c


示例12: NSCreateObjectFileImageFromFile

void *vmddlopen( const char *path) {
    NSObjectFileImage image;
    NSObjectFileImageReturnCode retval;
    NSModule module;

    retval = NSCreateObjectFileImageFromFile(path, &image);
    if (retval != NSObjectFileImageSuccess)
        return NULL;

    module = NSLinkModule(image, path,
                          NSLINKMODULE_OPTION_BINDNOW | NSLINKMODULE_OPTION_PRIVATE
                          | NSLINKMODULE_OPTION_RETURN_ON_ERROR);
    return module;  /* module will be NULL on error */
}
开发者ID:yupinov,项目名称:gromacs,代码行数:14,代码来源:vmddlopen.c


示例13: 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 loader_data, const char *filename,
         lt_dladvise LT__UNUSED advise)
{
  lt_module module = 0;
  NSObjectFileImage ofi = 0;

  if (!filename)
    {
      return (lt_module) -1;
    }

  switch (NSCreateObjectFileImageFromFile (filename, &ofi))
    {
    case NSObjectFileImageSuccess:
      module = NSLinkModule (ofi, filename, NSLINKMODULE_OPTION_RETURN_ON_ERROR
			     		    | NSLINKMODULE_OPTION_PRIVATE
			     		    | NSLINKMODULE_OPTION_BINDNOW);
      NSDestroyObjectFileImage (ofi);

      if (module)
	{
	  lt__module_export (module);
	}
      break;

    case NSObjectFileImageInappropriateFile:
      if (lt__image_symbol_p && lt__image_symbol)
	{
	  module = (lt_module) lt__addimage(filename,
					    NSADDIMAGE_OPTION_RETURN_ON_ERROR);
	}
      break;

    case NSObjectFileImageFailure:
    case NSObjectFileImageArch:
    case NSObjectFileImageFormat:
    case NSObjectFileImageAccess:
      /*NOWORK*/
      break;
    }

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

  return module;
}
开发者ID:kam-zhang,项目名称:kamOwnInformation,代码行数:52,代码来源:dyld.c


示例14: NSCreateObjectFileImageFromFile

void *ILDynLibraryOpen(const char *name)
{
	NSObjectFileImage file;
	NSObjectFileImageReturnCode result;
	NSModule module;
	void *image;
	const char *msg;

	/* Attempt to open the dylib file */
	result = NSCreateObjectFileImageFromFile(name, &file);
	if(result == NSObjectFileImageInappropriateFile)
	{
		/* May be an image, and not a bundle */
		image = (void *)NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
		if(image)
		{
			return image;
		}
	}
	if(result != NSObjectFileImageSuccess)
	{
		switch(result)
		{
			case NSObjectFileImageFailure:
				msg = " (NSObjectFileImageFailure)"; break;
			case NSObjectFileImageInappropriateFile:
				msg = " (NSObjectFileImageInappropriateFile)"; break;
			case NSObjectFileImageArch:
				msg = " (NSObjectFileImageArch)"; break;
			case NSObjectFileImageFormat:
				msg = " (NSObjectFileImageFormat)"; break;
			case NSObjectFileImageAccess:
				msg = " (NSObjectFileImageAccess)"; break;
			default:
				msg = ""; break;
		}
	#ifdef IL_DYNLIB_DEBUG
		fprintf(stderr, "%s: could not load dynamic library%s\n", name, msg);
	#endif
		return 0;
	}

	/* Link the module dependencies */
	module = NSLinkModule(file, name,
						  NSLINKMODULE_OPTION_BINDNOW |
						  NSLINKMODULE_OPTION_PRIVATE |
						  NSLINKMODULE_OPTION_RETURN_ON_ERROR);
	return (void *)module;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:49,代码来源:dynlib.c


示例15: mydlopen

static void *
mydlopen(char *path)
{
    int dyld_result;
    NSObjectFileImage ofile;
    NSModule handle = NULL;
    dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
    if (dyld_result != NSObjectFileImageSuccess) {
      LOCAL_dl_errno = dyld_result;
    } else {
      /* NSLinkModule will cause the run to abort on any link error's */
      /* not very friendly but the error recovery functionality is limited */
        handle = NSLinkModule(ofile, path, TRUE);
    } return handle;
}
开发者ID:davidvaz,项目名称:yap-cmake,代码行数:15,代码来源:load_dyld.c


示例16: dyld_dlopen

static void * dyld_dlopen(const char * file)
{
	NSObjectFileImage o=NULL;
	NSObjectFileImageReturnCode r;
	NSModule m=NULL;
	const unsigned int flags =  NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE;
	dyld_error_set=0;
	r = NSCreateObjectFileImageFromFile(file,&o);
	if (NSObjectFileImageSuccess == r)
	{
		m=NSLinkModule(o,file,flags);
		NSDestroyObjectFileImage(o);
		if (!m) dyld_error_set=1;
	}
        return (void*)m;
}
开发者ID:cention-nazri,项目名称:libdbi,代码行数:16,代码来源:dbi_main.c


示例17: NSCreateObjectFileImageFromFile

void *dynamic_link_file( const char *path )
{
  NSObjectFileImageReturnCode irc;
  NSObjectFileImage mo;
  NSModule mp;

  irc = NSCreateObjectFileImageFromFile( path, &mo );

  if (irc != NSObjectFileImageSuccess) {
    return NULL;
  }

  mp = NSLinkModule( mo, "slave.so", NSLINKMODULE_OPTION_BINDNOW );

  return mp;
}
开发者ID:Fuhuiang,项目名称:rscheme,代码行数:16,代码来源:dynlink.c


示例18: main

int main()
{
// NSCreateObjectFileImageFromMemory is only available on Mac OS X - not iPhone OS
#if __MAC_OS_X_VERSION_MIN_REQUIRED
    NSObjectFileImage ofi;
    if ( NSCreateObjectFileImageFromFile("test.bundle", &ofi) != NSObjectFileImageSuccess ) {
        FAIL("NSCreateObjectFileImageFromFile failed");
        return 1;
    }

    NSModule mod = NSLinkModule(ofi, "test.bundle", NSLINKMODULE_OPTION_NONE);
    if ( mod == NULL ) {
        FAIL("NSLinkModule failed");
        return 1;
    }

    NSSymbol sym = NSLookupSymbolInModule(mod, "_checkdata");
    if ( sym == NULL ) {
        FAIL("NSLookupSymbolInModule failed");
        return 1;
    }

    CheckFunc func = NSAddressOfSymbol(sym);
    if ( !func() ) {
        FAIL("NSAddressOfSymbol failed");
        return 1;
    }

    if ( !NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED) ) {
        FAIL("NSUnLinkModule failed");
        return 1;
    }

    if ( !NSDestroyObjectFileImage(ofi) ) {
        FAIL("NSDestroyObjectFileImage failed");
        return 1;
    }

    // call function again, even though bundle is unloaded
    func();
#endif

    PASS("bundle-basic");
    return 0;
}
开发者ID:johndpope,项目名称:dyld,代码行数:45,代码来源:main.c


示例19: Unload

DWORD OSXPluginInstance::Load(const char *fname)
{
  if (fname==NULL || fname[0]==0)
    return FF_FAIL;

  Unload();
  
  if (NSCreateObjectFileImageFromFile(fname, &m_ffImage)!=NSObjectFileImageSuccess)
    return FF_FAIL;

  NSModule m_ffModule =
    NSLinkModule(
      m_ffImage,
      fname,
      NSLINKMODULE_OPTION_NONE);
      
  if (m_ffModule==NULL)
  {
    Unload(); //to undo NSCreateObjectFileImageFromFile
    return FF_FAIL;
  }
  
  NSSymbol s = NSLookupSymbolInModule(m_ffModule, "_plugMain");
  if (s==NULL)
  {
    Unload();//to undo NSLinkModule and NSCreateObjectFileImageFromFile
    return FF_FAIL;
  }
  
	FF_Main_FuncPtr pFreeFrameMain = (FF_Main_FuncPtr)NSAddressOfSymbol(s);

	if (pFreeFrameMain==NULL)
  {
    Unload(); //to undo same
    return FF_FAIL;
  }
  
  m_ffPluginMain = pFreeFrameMain;
  
  DWORD rval = InitPluginLibrary();
  if (rval!=FF_SUCCESS)
    return rval;
  
  return FF_SUCCESS;
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:45,代码来源:OSXPluginInstance.cpp


示例20: ll_load

static void* ll_load (lua_State *L, const char* path) {
  NSObjectFileImage img;
  NSObjectFileImageReturnCode ret;
  /* this would be a rare case, but prevents crashing if it happens */
  if(!_dyld_present()) {
    lua_pushliteral(L, "dyld not present");
    return nullptr;
  }
  ret = NSCreateObjectFileImageFromFile(path, &img);
  if (ret == NSObjectFileImageSuccess) {
    NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE |
                       NSLINKMODULE_OPTION_RETURN_ON_ERROR);
    NSDestroyObjectFileImage(img);
    if (mod == nullptr) pusherror(L);
    return mod;
  }
  lua_pushstring(L, errorfromcode(ret));
  return nullptr;
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:19,代码来源:loadlib.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NSLookupSymbolInModule函数代码示例发布时间:2022-05-30
下一篇:
C++ NSLinkEditError函数代码示例发布时间: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