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

C++ OpenLibrary函数代码示例

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

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



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

示例1: amiga_sockinit

void amiga_sockinit() {
    if ((SocketBase = OpenLibrary("bsdsocket.library", 1L)) == NULL) {
	printf("Error opening bsdsocket.library\n");
	exit(10);
    }
    SetErrnoPtr(&errno, sizeof(errno));
}
开发者ID:DailyR,项目名称:mudos,代码行数:7,代码来源:socket.c


示例2: startup_run_update

// Run the update module
void startup_run_update()
{
    struct Library *ModuleBase;
#ifdef __amigaos4__
    struct ModuleIFace *IModule;
#endif

    // Try and get update.module
#ifdef __amigaos4__
    if (OpenLibIFace("dopus5:modules/update.module", (APTR)&ModuleBase, (APTR)&IModule, LIB_VERSION))
#else
    if ((ModuleBase=OpenLibrary("dopus5:modules/update.module",0)))
#endif
    {
        // Launch update function
        Module_Entry(0,0,0,0,0,0);

        // Expunge library
        Module_Expunge();

        // Close library
#ifdef __amigaos4__
        DropInterface((struct Interface *)IModule);
#endif
        CloseLibrary(ModuleBase);
    }
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:28,代码来源:main.c


示例3: main

void main(int argc, char *argv[]) {
  int nodnr, state = 0, i;
  if(argc < 2) {
    puts("Usage: SetNodeState <nodenr> [SERCLOSED] [NOANSWER] [LOGOUT]");
    return;
  }
  nodnr = atoi(argv[1]);
  for(i = 2; i < argc; i++) {
    if(!stricmp(argv[i],"SERCLOSED")) {
      state |= NIKSTATE_CLOSESER;
    }
    if(!stricmp(argv[i],"NOANSWER")) {
      state |= NIKSTATE_NOANSWER;
    }
    if(!stricmp(argv[i],"LOGOUT")) {
      state |= NIKSTATE_LOGOUT;
    }
  }
  if(NiKomBase = OpenLibrary("nikom.library",0)) {
    if(SetNodeState(nodnr,state)) {
      puts("Suceeded");
    } else {
      puts("Failed");
    }
    CloseLibrary(NiKomBase);
  } else {
    puts("Kunde inte öppna nikom.library");
  }
}
开发者ID:jayminer81,项目名称:NiKom,代码行数:29,代码来源:SetNodeState.c


示例4: main

int main(int argc, char **argv)
{
    struct PartitionHandle *root;
    char *device = "fdsk.device";
    ULONG unit = 1;

    if (argc > 2)
    {
        device = argv[1];
        unit = atoi(argv[2]);
    }

    PartitionBase = (struct PartitionBase *)OpenLibrary("partition.library", 1);
    if (PartitionBase)
    {
        root = OpenRootPartition(device, unit);
        if (root)
        {
            printf("got root handle of %s unit %d\n", device, (int)unit);

            if (PrintPartitionTable(root, 0))
                printf("Couldn't read partition table\n");

            CloseRootPartition(root);
        }
        else
            printf("No root handle for %s unit %d\n", device, (int)unit);
        CloseLibrary((struct Library *)PartitionBase);
    }
    else
        printf("No partition.library\n");

    return 0;
}
开发者ID:michalsc,项目名称:AROS,代码行数:34,代码来源:partition.c


示例5: strcpy

// Open a module
struct Library *OpenModule(char *name)
{
	struct Library *lib = NULL;
	char buf[256];
	short a,ver=0;

	// See if this is one of our modules
	for (a=0;dopus_modules[a];a++)
		if (stricmp(name,dopus_modules[a])==0)
		{
			// Need newest version
			ver=LIB_VERSION;
			break;
		}
/* We can't check for valid modules in a LIBS: multiassign etc.
	// See if it's in RAM
	if ((lib=OpenLibrary(name,ver)))
		return lib;
*/
	// Build name in modules directory
	strcpy(buf,"dopus5:modules/");
	strcat(buf,name);

	// Open library
	if (!(lib=OpenLibrary(buf,ver)))
	{
		// Show error
		error_request(GUI->window,1,GetString(&locale,MSG_OPENING),-1,name,0);
	}

	return lib;
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:33,代码来源:misc.c


示例6: pgsql_load_dll

static int pgsql_load_dll(void)
{
	if ((handle = OpenLibrary(PGSQL_LIB)) == NULL) return -1;
	
	if (	((p_PQclear		= (f_PQclear)		GetFunction(handle, "PQclear"))		== NULL) ||
		((p_PQcmdTuples		= (f_PQcmdTuples)	GetFunction(handle, "PQcmdTuples"))	== NULL) ||
		((p_PQerrorMessage	= (f_PQerrorMessage)	GetFunction(handle, "PQerrorMessage"))	== NULL) ||
		((p_PQescapeString	= (f_PQescapeString)	GetFunction(handle, "PQescapeString"))	== NULL) ||
		((p_PQexec		= (f_PQexec)		GetFunction(handle, "PQexec"))		== NULL) ||
		((p_PQfinish		= (f_PQfinish)		GetFunction(handle, "PQfinish"))	== NULL) ||
		((p_PQfname		= (f_PQfname)		GetFunction(handle, "PQfname"))		== NULL) ||
		((p_PQgetvalue		= (f_PQgetvalue)	GetFunction(handle, "PQgetvalue"))	== NULL) ||
		((p_PQnfields		= (f_PQnfields)		GetFunction(handle, "PQnfields"))	== NULL) ||
		((p_PQntuples		= (f_PQntuples)		GetFunction(handle, "PQntuples"))	== NULL) ||
		((p_PQresultStatus	= (f_PQresultStatus)	GetFunction(handle, "PQresultStatus"))	== NULL) ||
		((p_PQsetdbLogin	= (f_PQsetdbLogin)	GetFunction(handle, "PQsetdbLogin"))	== NULL) ||
		((p_PQstatus		= (f_PQstatus)		GetFunction(handle, "PQstatus"))	== NULL) )
	{
		CloseLibrary(handle);
		handle = NULL;
		return -1;
	}
			
	return 0;
}
开发者ID:DizKragnet,项目名称:pvpgn,代码行数:25,代码来源:sql_pgsql.cpp


示例7: amiga_init

BOOL amiga_init()
{
  if(!SocketBase)
    SocketBase = OpenLibrary("bsdsocket.library", 4);
  
  if(!SocketBase) {
    __request("No TCP/IP Stack running!");
    return FALSE;
  }
  
  if(SocketBaseTags(
    SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
//    SBTM_SETVAL(SBTC_HERRNOLONGPTR),     (ULONG) &h_errno,
    SBTM_SETVAL(SBTC_LOGTAGPTR),       (ULONG) "cURL",
  TAG_DONE)) {
    
    __request("SocketBaseTags ERROR");
    return FALSE;
  }
  
#ifndef __libnix__
  atexit(amiga_cleanup);
#endif
  
  return TRUE;
}
开发者ID:AlexeyS,项目名称:cmake,代码行数:26,代码来源:amigaos.c


示例8: NetworkCoreInitialize

/**
 * Initializes the network core (as that is needed for some platforms
 * @return true if the core has been initialized, false otherwise
 */
bool NetworkCoreInitialize()
{
#if defined(__MORPHOS__) || defined(__AMIGA__)
	/*
	 *  IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_
	 *  network related function, else: crash.
	 */
	DEBUG(net, 3, "[core] loading bsd socket library");
	SocketBase = OpenLibrary("bsdsocket.library", 4);
	if (SocketBase == NULL) {
		DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable");
		return false;
	}

#if defined(__AMIGA__)
	/* for usleep() implementation (only required for legacy AmigaOS builds) */
	TimerPort = CreateMsgPort();
	if (TimerPort != NULL) {
		TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest);
		if (TimerRequest != NULL) {
			if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) {
				TimerBase = TimerRequest->tr_node.io_Device;
				if (TimerBase == NULL) {
					/* free resources... */
					DEBUG(net, 0, "[core] can't initialize timer, network unavailable");
					return false;
				}
			}
		}
	}
开发者ID:IchiroWang,项目名称:OpenTTD,代码行数:34,代码来源:core.cpp


示例9: OpenLibs

static void OpenLibs(void)
{
    if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",39)))
    {
	Cleanup("Can't open intuition.library V39!");
    }

    if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",39)))
    {
	Cleanup("Can't open graphics.library V39!");
    }

    if (!(LayersBase = OpenLibrary("layers.library",39)))
    {
	Cleanup("Can't open layers.library V39!");
    }
}
开发者ID:michalsc,项目名称:AROS,代码行数:17,代码来源:clippingtest.c


示例10: Init

/* Open and initialize AmiSSL */
static BOOL Init(void)
{
	BOOL is_ok = FALSE;

	if (!(SocketBase = OpenLibrary("bsdsocket.library", 4)))
		FPrintf(GetStdErr(), "Couldn't open bsdsocket.library v4!\n");
#if defined(__amigaos4__)
	else if (!(ISocket = (struct SocketIFace *)GetInterface(SocketBase, "main", 1, NULL)))
		FPrintf(GetStdErr(), "Couldn't get Socket interface!\n");
#endif
	else if (!(AmiSSLMasterBase = OpenLibrary("amisslmaster.library",
	                                          AMISSLMASTER_MIN_VERSION)))
		FPrintf(GetStdErr(), "Couldn't open amisslmaster.library v"
		                     MKSTR(AMISSLMASTER_MIN_VERSION) "!\n");
#if defined(__amigaos4__)
	else if (!(IAmiSSLMaster = (struct AmiSSLMasterIFace *)GetInterface(AmiSSLMasterBase,
	                                                                    "main", 1, NULL)))
		FPrintf(GetStdErr(), "Couldn't get AmiSSLMaster interface!\n");
#endif
	else if (!InitAmiSSLMaster(AMISSL_CURRENT_VERSION, TRUE))
		FPrintf(GetStdErr(), "AmiSSL version is too old!\n");
	else if (!(AmiSSLBase = OpenAmiSSL()))
		FPrintf(GetStdErr(), "Couldn't open AmiSSL!\n");
#if defined(__amigaos4__)
	else if (!(IAmiSSL = (struct AmiSSLIFace *)GetInterface(AmiSSLBase,
	                                                        "main", 1, NULL)))
		FPrintf(GetStdErr(), "Couldn't get AmiSSL interface!\n");
#endif
#if defined(__amigaos4__)
	else if (InitAmiSSL(AmiSSL_ErrNoPtr, &errno,
	                    AmiSSL_ISocket, ISocket,
	                    TAG_DONE) != 0)
#else
	else if (InitAmiSSL(AmiSSL_ErrNoPtr, &errno,
	                    AmiSSL_SocketBase, SocketBase,
	                    TAG_DONE) != 0)
#endif
		FPrintf(GetStdErr(), "Couldn't initialize AmiSSL!\n");
	else
		is_ok = TRUE;

	if (!is_ok)
		Cleanup(); /* This is safe to call even if something failed above */

	return(is_ok);
}
开发者ID:jens-maus,项目名称:amissl,代码行数:47,代码来源:https.c


示例11: setup

void setup()
{
	ExpatBase = OpenLibrary("expat.library", 4);
	IExpat = (struct ExpatIFace*)GetInterface(ExpatBase, "main", 1, NULL);
	if ( IExpat == 0 )  {
		DebugPrintF("Can't open expat.library\n");
	}
}
开发者ID:JulianSpillane,项目名称:moai-dev,代码行数:8,代码来源:launch.c


示例12: texture_init

TEXTURE_INFO *stub_texture_init(char *name, struct Library **Base)
{
	*Base = OpenLibrary(name, 0);
	if(!Base)
		return NULL;
	TextureBase = *Base;

	return texture_init();
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:9,代码来源:ppc_stubs.cpp


示例13: ASM

/* Initialize library */
static ASM(struct Library *) LibInit(REG(a0, SEGLISTPTR seglist),
REG(d0, struct MCP9808BaseP * MCP9808Base), REG(a6, struct ExecBase *SysBase))
{
#ifdef _M68060
  if(!(SysBase->AttnFlags & AFF_68060))
    return 0;
#elif defined (_M68040)
  if(!(SysBase->AttnFlags & AFF_68040))
    return 0;
#elif defined (_M68030)
  if(!(SysBase->AttnFlags & AFF_68030))
    return 0;
#elif defined (_M68020)
  if(!(SysBase->AttnFlags & AFF_68020))
    return 0;
#endif

  /* Remember stuff */
  MCP9808Base->i2cClass_SegList = seglist;
  MCP9808Base->i2cClass_SysBase = SysBase;

#ifdef BASE_GLOBAL
  MakeGlobalSys(MCP9808Base);
#endif

  if((MCP9808Base->i2cClass_IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37)))
  {
    if((MCP9808Base->i2cClass_UtilityBase = (struct UtilityBase *) OpenLibrary("utility.library", 37)))
    {
#ifdef BASE_GLOBAL
      MakeGlobalLibs(MCP9808Base);
#endif
      return &MCP9808Base->i2cClass_LibNode;
    }
    CloseLibraries(MCP9808Base);
  }

  /* Free the vector table and the library data */
  FreeMem((STRPTR) MCP9808Base - MCP9808Base->i2cClass_LibNode.lib_NegSize,
                MCP9808Base->i2cClass_LibNode.lib_NegSize +
                MCP9808Base->i2cClass_LibNode.lib_PosSize);

  return 0;
}
开发者ID:Sakura-IT,项目名称:AmI2C,代码行数:45,代码来源:libinit.c


示例14: main

int
main( void )
{
  struct Library* EMU10kxBase;
  struct EMU10kxAC97* EMU10kxAC97;
  ULONG value;

  EMU10kxBase = OpenLibrary( "DEVS:AHI/emu10kx.audio", VERSION );
  
  if( EMU10kxBase == NULL )
  {
    Printf( "Unable to open DEVS:AHI/emu10kx.audio version %ld.\n", VERSION );
    return RETURN_FAIL;
  }

  Forbid();
  EMU10kxAC97 = (struct EMU10kxAC97*) FindSemaphore( EMU10KX_AC97_SEMAPHORE );
  if( EMU10kxAC97 != NULL )
  {
    ObtainSemaphore( &EMU10kxAC97->Semaphore );
  }
  Permit();

  if( EMU10kxAC97 == NULL )
  {
    CloseLibrary( EMU10kxBase );
    Printf( "Unable to find semaphore '%s'.\n", (ULONG) EMU10KX_AC97_SEMAPHORE );
    return RETURN_FAIL;
  }

  Printf( "%ld EMU10kx cards found.\n", EMU10kxAC97->Cards );
  
  value = CallHook( &EMU10kxAC97->GetFunc, (Object*) EMU10kxBase,
		    0, AC97_CD_VOL );

  Printf( "CD volume on card 0 is 0x%04lx\n", value );

  Printf( "Setting it to 0x0000.\n" );
  CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, 0 );

  Delay( 3 * 50 );

  Printf( "Restoring it.\n" );
  CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, value );

  Printf( "Exiting.\n" );
  
  if( EMU10kxAC97 != NULL )
  {
    ReleaseSemaphore( &EMU10kxAC97->Semaphore );
  }

  CloseLibrary( EMU10kxBase );

  return RETURN_OK;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:56,代码来源:test_ac97.c


示例15: server_connect

static SOCKET server_connect(const char *host, unsigned short nport)
{
	struct hostent *he;
	char **ap;

#ifdef WIN32
	static int need_init = 1;
	if (need_init) {
		WSADATA wsa;
		if (WSAStartup(MAKEWORD(2, 0), &wsa))
			return INVALID_SOCKET;
		need_init = 0;
	}
#elif defined(USE_AMITCP)
	if (!socket_base) {
		socket_base = OpenLibrary("bsdsocket.library", 4);
		if (!socket_base)
			return INVALID_SOCKET;
	}
#endif

	he = gethostbyname(host);
	if (!he)
		return INVALID_SOCKET;

	for (ap = he->h_addr_list; *ap; ++ap) {
		SOCKET sock;
		struct sockaddr_in sa;

		sa.sin_family = he->h_addrtype;
		sa.sin_port = htons(nport);
		memcpy(&sa.sin_addr, *ap, he->h_length);
		memset(&sa.sin_zero, 0, sizeof(sa.sin_zero));

		sock = socket(he->h_addrtype, SOCK_STREAM, 0);
		if (sock == INVALID_SOCKET)
			continue;

		if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) >= 0) {
			char greet[128];

			if (xsend(sock, CLIENT_GREET, strlen(CLIENT_GREET), 0) ||
				xrecv(sock, greet, strlen(SERVER_GREET), 0)) {
				closesocket(sock);
				continue;
			}

			if (!strncmp(SERVER_GREET, greet, strlen(SERVER_GREET)))
				return sock;
		}

		closesocket(sock);
	}

	return INVALID_SOCKET;
}
开发者ID:bowlofstew,项目名称:vlee,代码行数:56,代码来源:sync_device.c


示例16: main

void main(int argc,char **argv)
{
    if (DOpusBase=OpenLibrary("dopus5.library",0))
    {
        if (argv[1] && *argv[1])
            ShowDebug(argv[1]);
        CloseLibrary(DOpusBase);
    }
    exit(0);
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:10,代码来源:diag.c


示例17: PreClassInitFunc

BOOL PreClassInitFunc(void)
{
  if((LocaleBase = OpenLibrary("locale.library", 37L)) &&
     GETINTERFACE(ILocale, LocaleBase))
  {
    return TRUE;
  }

  return FALSE;
}
开发者ID:amiga-mui,项目名称:toolbar,代码行数:10,代码来源:library.c


示例18: _LibInit

struct DriverBase*
_LibInit( struct DriverBase* AHIsubBase,
	  BPTR               seglist,
	  struct ExecBase*   sysbase )
{
  SysBase = sysbase;

  AHIsubBase->library.lib_Node.ln_Type = NT_LIBRARY;
  AHIsubBase->library.lib_Node.ln_Name = (STRPTR) LibName;
  AHIsubBase->library.lib_Flags        = LIBF_SUMUSED | LIBF_CHANGED;
  AHIsubBase->library.lib_Version      = VERSION;
  AHIsubBase->library.lib_Revision     = REVISION;
  AHIsubBase->library.lib_IdString     = (STRPTR) LibIDString;
  AHIsubBase->seglist                  = seglist;

  AHIsubBase->intuitionbase = OpenLibrary( INTUITIONNAME, 37 );
  AHIsubBase->utilitybase   = OpenLibrary( UTILITYNAME, 37 );

  if( IntuitionBase == NULL )
  {
    Alert( AN_Unknown|AG_OpenLib|AO_Intuition );
    goto error;
  }
  
  if( UtilityBase == NULL )
  {
    Req( "Unable to open 'utility.library' version 37.\n" );
    goto error;
  }

  if( ! DriverInit( AHIsubBase ) )
  {
    goto error;
  }


  return AHIsubBase;

error:
  _LibExpunge( AHIsubBase );
  return NULL;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:42,代码来源:library.c


示例19: main

int main(int argc, char *argv[])
{
	if (DataTypesBase=OpenLibrary("datatypes.library",0)) {
		if (dto=NewDTObject(argv[1],TAG_DONE)) {
			DoQuery(argv[1]);
			DisposeDTObject(dto);
		}
		CloseLibrary(DataTypesBase);
	}
	return 0;
}
开发者ID:gfazioli,项目名称:Assembly-Library,代码行数:11,代码来源:DT4C.C


示例20: checkusergrouplib

int checkusergrouplib(void)
{
	if(!UserGroupBase)
	{
		if(!(UserGroupBase=OpenLibrary("usergroup.library",4)))
		{
			PyErr_SetString(PyExc_SystemError, "Couldn't open usergroup.library");
			return 0;
		}
	}
	return 1;
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:12,代码来源:AmigaPythonEmbed.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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