Update documentation in dlfcn.h, specially for RTLD_LAZY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
diff --git a/dlfcn.c b/dlfcn.c
index c5d4b3c..e13c631 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -225,10 +225,10 @@ void *dlopen( const char *file, int mode )
* all symbols from the original program file, and any objects loaded
* with the RTLD_GLOBAL flag.
* The return value from GetModuleHandle( ) allows us to retrieve
- * symbols only from the original program file. For objects loaded with
- * the RTLD_GLOBAL flag, we create our own list later on. For objects
- * outside of the program file but already loaded (e.g. linked DLLs)
- * they are added below.
+ * symbols only from the original program file. EnumProcessModules() is
+ * used to access symbols from other libraries. For objects loaded
+ * with the RTLD_LOCAL flag, we create our own list later on. They are
+ * excluded from EnumProcessModules() iteration.
*/
hModule = GetModuleHandle( NULL );
diff --git a/dlfcn.h b/dlfcn.h
index c0d7777..a10b86a 100644
--- a/dlfcn.h
+++ b/dlfcn.h
@@ -30,26 +30,41 @@ extern "C" {
# define DLFCN_EXPORT
#endif
-/* POSIX says these are implementation-defined.
- * To simplify use with Windows API, we treat them the same way.
- */
-
-#define RTLD_LAZY 0
+/* Relocations are performed when the object is loaded. */
#define RTLD_NOW 0
+/* Relocations are performed at an implementation-defined time.
+ * Windows API does not support lazy symbol resolving (when first reference
+ * to a given symbol occurs). So RTLD_LAZY implementation is same as RTLD_NOW.
+ */
+#define RTLD_LAZY RTLD_NOW
+
+/* All symbols are available for relocation processing of other modules. */
#define RTLD_GLOBAL (1 << 1)
+
+/* All symbols are not made available for relocation processing by other modules. */
#define RTLD_LOCAL (1 << 2)
/* These two were added in The Open Group Base Specifications Issue 6.
* Note: All other RTLD_* flags in any dlfcn.h are not standard compliant.
*/
+/* The symbol lookup happens in the normal global scope. */
#define RTLD_DEFAULT ((void *)0)
+
+/* Specifies the next object after this one that defines name. */
#define RTLD_NEXT ((void *)-1)
-DLFCN_EXPORT void *dlopen ( const char *file, int mode );
-DLFCN_EXPORT int dlclose(void *handle);
+/* Open a symbol table handle. */
+DLFCN_EXPORT void *dlopen(const char *file, int mode);
+
+/* Close a symbol table handle. */
+DLFCN_EXPORT int dlclose(void *handle);
+
+/* Get the address of a symbol from a symbol table handle. */
DLFCN_EXPORT void *dlsym(void *handle, const char *name);
+
+/* Get diagnostic information. */
DLFCN_EXPORT char *dlerror(void);
#ifdef __cplusplus