Author Michael.Felt
Recipients David.Edelsohn, Michael.Felt, aixtools@gmail.com, martin.panter
Date 2016-05-11.11:06:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462964799.22.0.957223070493.issue26439@psf.upfronthosting.co.za>
In-reply-to
Content
re:

AIX: CDLL("libcrypto.a(libcrypto.so.1.0.0)", DEFAULT_MODE | RTLD_MEMBER)

Officially it would be
dlopen("libcrypto.a(libcrypto.so.1.0.0)", RTLD_NOW | RTLD_MEMBER)

Further, that would only load the 32-bit version, as there is a legacy naming scheme for the 64-bit members (the same name may actually occur twice - once for each size)

Example: the ar command showing all members regardless of size:
root@x064:[/]ar -Xany tv /usr/lib/libcrypto.a
rwxr-xr-x     0/0     2967588 Jul 24 13:46 2015 libcrypto.so
rwxr-xr-x     0/0     2256131 Jul 24 13:43 2015 libcrypto.so.0.9.8
rwxr-xr-x     0/0     2967588 Jul 24 13:45 2015 libcrypto.so.1.0.0
rwxr-xr-x     0/0     3376521 Jul 24 13:46 2015 libcrypto64.so
rwxr-xr-x     0/0     2606185 Jul 24 13:44 2015 libcrypto64.so.0.9.8
rwxr-xr-x     0/0     3376521 Jul 24 13:45 2015 libcrypto64.so.1.0.0

Note: the default archives (ending in .so) are "same size, checksum, etc" as the .so.1.0.0 versioned members.

Also, this can be more complex - e.g., if LibreSSL is also included (I am re-working my packaging so that I will also have both 32 and 64-bit packaging, for now only 32-bit is available)

michael@x071:[/home/michael]ar -X32 tv /opt/lib/libcrypto.a
rwxr-xr-x     0/0     3060762 Jun 17 21:17 2015 libcrypto.so.33
rwxrwxr-x     0/0     2965597 Jul 25 16:57 2015 libcrypto.so
rwxrwxr-x     0/0     2253850 Jul 25 17:03 2015 libcrypto.so.0.9.8
rwxrwxr-x     0/0     2965597 Jul 25 17:03 2015 libcrypto.so.1.0.0

IMHO: this is a needless complication for a programmer using ctypes.cdll - but who am I?

From the dlopen man page (aka InfoCenter)

Flags: (aka mode)
Specifies variations of the behavior of dlopen. Either RTLD_NOW or RTLD_LAZY must always be specified. Other flags may be OR'ed with RTLD_NOW or RTLD_LAZY.

RTLD_NOW 	Load all dependents of the module being loaded and resolve all symbols.

RTLD_LAZY 	Specifies the same behavior as RTLD_NOW. In a future release of the operating system, the behavior of the RTLD_LAZY may change so that loading of dependent modules is deferred of resolution of some symbols is deferred.

RTLD_MEMBER 	The dlopen subroutine can be used to load a module that is a member of an archive. The L_LOADMEMBER flag is used when the load subroutine is called. The module name FilePath names the archive and archive member according to the rules outlined in the load subroutine.

To be complete...

RTLD_GLOBAL 	Allows symbols in the module being loaded to be visible when resolving symbols used by other dlopen calls. These symbols will also be visible when the main application is opened with dlopen(NULL, mode).

RTLD_LOCAL 	Prevent symbols in the module being loaded from being used when resolving symbols used by other dlopen calls. Symbols in the module being loaded can only be accessed by calling dlsym subroutine. 

If neither RTLD_GLOBAL nor RTLD_LOCAL is specified, the default is RTLD_LOCAL. If both flags are specified, RTLD_LOCAL is ignored.
History
Date User Action Args
2016-05-11 11:06:39Michael.Feltsetrecipients: + Michael.Felt, martin.panter, David.Edelsohn, aixtools@gmail.com
2016-05-11 11:06:39Michael.Feltsetmessageid: <1462964799.22.0.957223070493.issue26439@psf.upfronthosting.co.za>
2016-05-11 11:06:39Michael.Feltlinkissue26439 messages
2016-05-11 11:06:38Michael.Feltcreate