📄 readme.dlfcn.aix
字号:
Copyright (c) 1992,1993,1995, Jens-Uwe Mager, Helios Software GmbHNot derived from licensed software.Permission is granted to freely use, copy, modify, and redistributethis software, provided that no attempt is made to gain profit from it,the author is not construed to be liable for any results of using thesoftware, alterations are clearly marked as such, and this notice isnot modified.libdl.a-------This is an emulation library to emulate the SunOS/System V.4 functionsto access the runtime linker. The functions are emulated by using theAIX load() function and by reading the .loader section of the loadedmodule to find the exports. The to be loaded module should be linked asfollows (if using AIX 3): cc -o module.so -bM:SRE -bE:module.exp -e _nostart $(OBJS)For AIX 4: cc -o module.so -bM:SRE -bE:module.exp -bnoentry $(OBJS)The module export file contains the symbols to be exported. Becausethis library uses the loader section, the final module.so file can bestripped. C++ users should build their shared objects using the scriptmakeC++SharedLib (part of the IBM C++ compiler), this will make surethat constructors and destructors for static and global objects will becalled upon loading and unloading the module.Usage-----void *dlopen(const char *path, int mode);This routine loads the module pointed to by path and reads its exporttable. If the path does not contain a '/' character, dlopen will searchfor the module using the LIBPATH environment variable. It returns anopaque handle to the module or NULL on error. The mode parameter can beeither RTLD_LAZY (for lazy function binding) or RTLD_NOW for immediatefunction binding. The AIX implementation currently does treat RTLD_NOWthe same as RTLD_LAZY. The flag RTLD_GLOBAL might be or'ed into themode parameter to allow loaded modules to bind to global variables orfunctions in other loaded modules loaded by dlopen(). If RTLD_GLOBAL isnot specified, only globals from the main part of the executable orshared libraries are used to look for undefined symbols in loadedmodules.void *dlsym(void *handle, const char *symbol);This routine searches for the symbol in the module referred to byhandle and returns its address. If the symbol could not be found, thefunction returns NULL. The return value must be casted to a properfunction pointer before it can be used. SunOS/System V.4 allow handleto be a NULL pointer to refer to the module the call is made from, thisis not implemented.int dlclose(void *handle);This routine unloads the module referred to by the handle and disposesof any local storage. this function returns -1 on failure.char *dlerror(void);This routine can be used to retrieve a text message describing the mostrecent error that occured on on of the above routines. This functionreturns NULL if there is not error information.Initialization and termination handlers---------------------------------------The emulation provides for an initialization and a terminationhandler. The dlfcn.h file contains a structure declaration nameddl_info with following members: void (*init)(void); void (*fini)(void);The init function is called upon first referencing the library. Thefini function is called at dlclose() time or when the process exits.The module should declare a variable named dl_info that contains thisstructure which must be exported. These functions correspond to thedocumented _init() and _fini() functions of SunOS 4.x, but these areappearently not implemented in SunOS. When using SunOS 5.0, thesecorrespond to #pragma init and #pragma fini respectively. At the sametime any static or global C++ object's constructors or destructors willbe called.Jens-Uwe MagerHELIOS Software GmbHLavesstr. 8030159 HannoverGermanyPhone: +49 511 36482-0FAX: +49 511 36482-69AppleLink: helios.de Attn: Jens-Uwe MagerInternet: jum@helios.deRevison History---------------SCCS/s.dlfcn.h:D 1.4 95/04/25 09:36:52 jum 4 3 00018/00004/00028MRs:COMMENTS:added RTLD_GLOBAL, include and C++ guardsD 1.3 92/12/27 20:58:32 jum 3 2 00001/00001/00031MRs:COMMENTS:we always have prototypes on RS/6000D 1.2 92/08/16 17:45:11 jum 2 1 00009/00000/00023MRs:COMMENTS:added dl_info structure to implement initialize and terminate functionsD 1.1 92/08/02 18:08:45 jum 1 0 00023/00000/00000MRs:COMMENTS:Erstellungsdatum und -uhrzeit 92/08/02 18:08:45 von jumSCCS/s.dlfcn.c:D 1.7 95/08/14 19:08:38 jum 8 6 00026/00004/00502MRs:COMMENTS:Integrated the fixes from Kirk Benell (kirk@rsinc.com) to allow loading ofshared objects generated under AIX 4. Fixed bug that symbols with exactly8 characters would use garbage characters from the following symbol value.D 1.6 95/04/25 09:38:03 jum 6 5 00046/00006/00460MRs:COMMENTS:added handling of C++ static constructors and destructors, added RTLD_GLOBAL to bind against other loaded modulesD 1.5 93/02/14 20:14:17 jum 5 4 00002/00000/00464MRs:COMMENTS:added path to dlopen error message to make clear where there error occured.D 1.4 93/01/03 19:13:56 jum 4 3 00061/00005/00403MRs:COMMENTS:to allow calling symbols in the main module call load with L_NOAUTODEFER and do a loadbind later with the main module.D 1.3 92/12/27 20:59:55 jum 3 2 00066/00008/00342MRs:COMMENTS:added search by L_GETINFO if module got loaded by LIBPATHD 1.2 92/08/16 17:45:43 jum 2 1 00074/00006/00276MRs:COMMENTS:implemented initialize and terminate functions, added reference counting to avoid multiple loads of the same libraryD 1.1 92/08/02 18:08:45 jum 1 0 00282/00000/00000MRs:COMMENTS:Erstellungsdatum und -uhrzeit 92/08/02 18:08:45 von jum
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -