Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Lib_Find.h
blob6496a93dc4d2e6d09b2b649051ef160be062a0fb
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Lib_Find.h
7 * All the static function calls needed to search and open shared
8 * libraries.
9 */
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"
20 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
22 namespace ACE
24 // = Methods for searching and opening shared libraries.
26 /**
27 * Finds the file @a filename either using an absolute path or using
28 * a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g.,
29 * $LD_LIBRARY_PATH on UNIX or the directories scanned by Win32 API
30 * SearchPath on Win32). This function will add appropriate suffix
31 * (e.g., .dll on Win32 or .so on UNIX) according to the OS
32 * platform. In addition, this function will apply the appropriate
33 * prefix (e.g., "lib" on UNIX and "" on Win32) if the @a filename
34 * doesn't match directly.
36 extern ACE_Export int ldfind (const ACE_TCHAR* filename,
37 ACE_TCHAR pathname[],
38 size_t maxpathnamelen);
40 /**
41 * Uses @c ldfind to locate and open the appropriate @a filename and
42 * returns a pointer to the file, else it returns a NULL
43 * pointer. @a type specifies how the file should be open.
45 extern ACE_Export FILE *ldopen (const ACE_TCHAR *filename,
46 const ACE_TCHAR *type);
48 /**
49 * Transforms @a entry_point into a form that can be located in a
50 * dynamic library using <dlsym>. For example, with Win32/Borland
51 * extern "C" functions which use the default calling convention
52 * have a '_' prepended. Always returns a buffer that has been
53 * dynamically allocated using <operator new>.
55 extern ACE_Export ACE_TCHAR *ldname (const ACE_TCHAR *entry_point);
57 /**
58 * Returns the temporary directory including the trailing slash in
59 * @a buffer. Returns -1 for an error or if the buffer_len is not
60 * long enough.
62 extern ACE_Export int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len);
64 /// Opening the temp file. File is automagically unlinked when it is
65 /// closed. This is useful for have temp files.
66 extern ACE_Export ACE_HANDLE open_temp_file (const ACE_TCHAR *name,
67 int mode,
68 int perm = 0);
70 // @@ Though the following functions don't come under the same category as
71 // above, these are used only in the functions in this class. So it makes
72 // more sense to move these functions too to this class.
74 /// Replace all instances of @a search in @a s with @a replace. Returns
75 /// the number of replacements made.
76 extern ACE_Export size_t strrepl (char *s, char search, char replace);
78 /**
79 * Splits string @a s into pieces separated by the string @a token.
80 * @a next_start is an opaque cookie handed back by the call to store
81 * its state for the next invocation, thus making it re-entrant.
82 * This operates very similar to Perl's @c split function except that
83 * it returns pieces one at a time instead of into an array.
85 extern ACE_Export char *strsplit_r (char *s,
86 const char *token,
87 char *&next_start);
89 #if defined (ACE_HAS_WCHAR)
90 /// As strrepl, but for wide characters.
91 extern ACE_Export size_t strrepl (wchar_t *s,
92 wchar_t search,
93 wchar_t replace);
95 /// As strsplit_r, but for wide characters.
96 extern ACE_Export wchar_t *strsplit_r (wchar_t *s,
97 const wchar_t *token,
98 wchar_t *&next_start);
99 #endif /* ACE_HAS_WCHAR */
102 ACE_END_VERSIONED_NAMESPACE_DECL
104 #include /**/ "ace/post.h"
105 #endif /* ACE_LIB_FIND_H */