本文整理汇总了C++中ACE_DLL::close方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_DLL::close方法的具体用法?C++ ACE_DLL::close怎么用?C++ ACE_DLL::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_DLL
的用法示例。
在下文中一共展示了ACE_DLL::close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
int
run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("DLL_Test"));
int retval = 0;
// Protection against this test being run on platforms not supporting Dlls.
#if defined(ACE_HAS_DYNAMIC_LINKING)
ACE_DLL dll;
retval += basic_test (dll);
retval += dynamic_cast_test (dll);
retval += handle_test (dll);
// Call close here so that any errors make it into the log.
dll.close ();
#else
ACE_ERROR ((LM_INFO,
ACE_TEXT ("Dynamically Linkable Libraries not supported on this platform\n")));
#endif /* ACE_HAS_DYNAMIC_LINKING */
ACE_END_TEST;
return retval == 0 ? 0 : 1;
}
示例2: magazine
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
ACE_DLL dll;
int retval = dll.open (ACE_DLL_PREFIX ACE_TEXT("DLL_Today"));
if (retval != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"%p",
"dll.open"),
-1);
Magazine_Creator mc;
// Cast the void* to non-pointer type first - it's not legal to
// cast a pointer-to-object directly to a pointer-to-function.
void *void_ptr = dll.symbol (ACE_TEXT ("create_magazine"));
ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (void_ptr);
mc = reinterpret_cast<Magazine_Creator> (tmp);
if (mc == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"%p",
"dll.symbol"),
-1);
}
{
auto_ptr <Magazine> magazine (mc ());
magazine->title ();
}
dll.close ();
// The other library is now loaded on demand.
retval = dll.open (ACE_DLL_PREFIX ACE_TEXT ("DLL_Newsweek"));
if (retval != 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"%p",
"dll.open"),
-1);
}
// Cast the void* to non-pointer type first - it's not legal to
// cast a pointer-to-object directly to a pointer-to-function.
void_ptr = dll.symbol (ACE_TEXT ("create_magazine"));
tmp = reinterpret_cast<ptrdiff_t> (void_ptr);
mc = reinterpret_cast<Magazine_Creator> (tmp);
if (mc == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"%p",
"dll.symbol"),
-1);
}
{
auto_ptr <Magazine> magazine (mc ());
magazine->title ();
}
dll.close ();
return 0;
}
示例3: singleton_test
// Check that the ACE_Based_Pointer_Repository can be accessed
// from a Windows DLL
// (see http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=1991)
int singleton_test (void)
{
void* baddr1 = ACE_BASED_POINTER_REPOSITORY::instance();
void* baddr2 = ACE_BASED_POINTER_REPOSITORY::instance();
if (baddr1 != baddr2)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_Based_Pointer_Repository is not a singleton\n")),
-1);
}
// Protection against this test being run on platforms not supporting Dlls.
#if defined(ACE_HAS_DYNAMIC_LINKING)
ACE_TString dll_file;
const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR");
if (subdir_env)
{
dll_file = ACE_TEXT_CHAR_TO_TCHAR (subdir_env);
dll_file += ACE_DIRECTORY_SEPARATOR_STR;
}
dll_file += OBJ_PREFIX ACE_TEXT ("Based_Pointer_Test_Lib") OBJ_SUFFIX;
// If DLL causes multiple instances of singleton
// then the ACE_Cleanup object registered
// with the ACE_Object_manager will no longer be valid,
// at exit time if the library is unloaded. Override
// the default close on destruct.
ACE_DLL dll;
int retval = dll.open (dll_file.c_str (),
ACE_DEFAULT_SHLIB_MODE,
0);
if (retval != 0)
{
ACE_TCHAR *dll_error = dll.error ();
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Error in DLL Open: %s\n"),
dll_error ? dll_error : ACE_TEXT ("unknown error")),
-1);
}
#if defined (ACE_OPENVMS)
// with OPENVMS symbol names > 31 cause us trouble with dlsym()
void* foo = dll.symbol (ACE_TEXT ("get_based_pointer_repo_inst"));
#else
void* foo = dll.symbol (ACE_TEXT ("get_based_pointer_repository_instance"));
#endif
// Cast the void* to function* with a long as intermediate.
ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (foo);
Get_Bp_Repository_Inst get_bp_repository_inst =
reinterpret_cast<Get_Bp_Repository_Inst> (tmp);
if (get_bp_repository_inst == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
dll.error ()),
-1);
void* baddr_dll = get_bp_repository_inst ();
dll.close ();
if (baddr_dll != baddr1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ACE_Based_Pointer_Repository is not a ")
ACE_TEXT ("singleton in DLL <%@> <%@>\n"),
baddr_dll,
baddr1),
-1);
}
#endif /* ACE_HAS_DYNAMIC_LINKING */
return 0;
}