16.3. Finding a Module

When you are writing a program that will load dynamic modules, a major stumbling block is writing the code to find the modules you want to load. If you are worried about portability (which you must be, or you wouldn't be reading this book!), you can't rely on the default search algorithm of the vendor dlopen function, because it varies from implementation to implementation. You can't even rely on the name of the module, because the module suffix varies according to the conventions of the target host (although you could insist on a particular suffix for modules you are willing to load).

Unfortunately, this means that you will need to implement your own searching algorithm and always use an absolute path name when you call ...

Get GNU Autoconf, Automake, and Libtool now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.