3 //=============================================================================
7 * All the static function calls needed to search and open shared
10 //=============================================================================
12 #ifndef ACE_LIB_FIND_H
13 #define ACE_LIB_FIND_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
17 #include /**/ "ace/ACE_export.h"
18 #include "ace/os_include/os_stdio.h"
19 #if defined (ACE_OPENVMS)
20 # include "ace/OS_NS_dlfcn.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 // = Methods for searching and opening shared libraries.
30 * Finds the file @a filename either using an absolute path or using
31 * a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g.,
32 * $LD_LIBRARY_PATH on UNIX or the directories scanned by Win32 API
33 * SearchPath on Win32). This function will add appropriate suffix
34 * (e.g., .dll on Win32 or .so on UNIX) according to the OS
35 * platform. In addition, this function will apply the appropriate
36 * prefix (e.g., "lib" on UNIX and "" on Win32) if the @a filename
37 * doesn't match directly.
39 extern ACE_Export
int ldfind (const ACE_TCHAR
* filename
,
41 size_t maxpathnamelen
);
44 * Uses @c ldfind to locate and open the appropriate @a filename and
45 * returns a pointer to the file, else it returns a NULL
46 * pointer. @a type specifies how the file should be open.
48 extern ACE_Export
FILE *ldopen (const ACE_TCHAR
*filename
,
49 const ACE_TCHAR
*type
);
52 * Transforms @a entry_point into a form that can be located in a
53 * dynamic library using <dlsym>. For example, with Win32/Borland
54 * extern "C" functions which use the default calling convention
55 * have a '_' prepended. Always returns a buffer that has been
56 * dynamically allocated using <operator new>.
58 extern ACE_Export ACE_TCHAR
*ldname (const ACE_TCHAR
*entry_point
);
61 #if defined (ACE_OPENVMS)
63 * Registers an @a entry_point and its address for later retrieval
64 * through the ACE::ldsymbol () method.
65 * For use in cases where the OS compiler encodes long symbolnames.
67 extern ACE_Export
void ldregister (const ACE_TCHAR
*entry_point
,
71 * Looks up an @a entry_point address either from previously registered
72 * symbols or through ACE_OS::dlsym ().
73 * Returns 0 in case the entry_point is not found, otherwise nonzero.
74 * For use in cases where the OS compiler encodes long symbolnames.
76 extern ACE_Export
void *ldsymbol (ACE_SHLIB_HANDLE sh
,
77 const ACE_TCHAR
*entry_point
);
81 * Returns the temporary directory including the trailing slash in
82 * @a buffer. Returns -1 for an error or if the buffer_len is not
85 extern ACE_Export
int get_temp_dir (ACE_TCHAR
*buffer
, size_t buffer_len
);
87 /// Opening the temp file. File is automagically unlinked when it is
88 /// closed. This is useful for have temp files.
89 extern ACE_Export ACE_HANDLE
open_temp_file (const ACE_TCHAR
*name
,
93 // @@ Though the following functions don't come under the same category as
94 // above, these are used only in the functions in this class. So it makes
95 // more sense to move these functions too to this class.
97 /// Replace all instances of @a search in @a s with @a replace. Returns
98 /// the number of replacements made.
99 extern ACE_Export
size_t strrepl (char *s
, char search
, char replace
);
102 * Splits string @a s into pieces separated by the string @a token.
103 * @a next_start is an opaque cookie handed back by the call to store
104 * its state for the next invocation, thus making it re-entrant.
105 * This operates very similar to Perl's @c split function except that
106 * it returns pieces one at a time instead of into an array.
108 extern ACE_Export
char *strsplit_r (char *s
,
112 #if defined (ACE_HAS_WCHAR)
113 /// As strrepl, but for wide characters.
114 extern ACE_Export
size_t strrepl (wchar_t *s
,
118 /// As strsplit_r, but for wide characters.
119 extern ACE_Export
wchar_t *strsplit_r (wchar_t *s
,
120 const wchar_t *token
,
121 wchar_t *&next_start
);
122 #endif /* ACE_HAS_WCHAR */
125 ACE_END_VERSIONED_NAMESPACE_DECL
127 #include /**/ "ace/post.h"
128 #endif /* ACE_LIB_FIND_H */