[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to know what modules were dlpreopen-ed?

From: Gary V. Vaughan
Subject: Re: How to know what modules were dlpreopen-ed?
Date: Mon, 13 Oct 2003 11:20:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

Kevin P. Fleming wrote:
I've got an application here with a number of plugin modules (about 30). The user can pick and choose which ones they want to build at configure time, and that all works fine.

I now want to support the user building an all-static version of the application if they desire; to that end, I have switched to using ltdl instead of libdl directly, so that I prepare for using dlpreopen-ed modules. Switching to ltdl has not been a problem, I can still build a shared-library version of the app and everything works fine.

Now I'm trying to set up support for the preopened modules; I have added the call to LTDL_SET_PRELOADED_SYMBOLS at the appropriate place in the code. However, I cannot find any way to determine the _list_ of modules that were preopened, so that I can lt_dlsym them to get symbol addresses. I don't want to have to know this ahead of time if at all possible, but if I have to build a static list to compile into the program I can do so. I'd much rather just interate through the "real" lt_dlsymlist structure myself and determine what modules were preopened, then go from there.

Is this possible?

I've not come across needing to dynamically determine the names of statically preopened modules with ltdl before, and there is no API support for that, but since your has to know which modules were preopened (when it passes the -dlopen flags to libtool), why not generate a header that contains the module names?

    preopened.h: Makefile
        @echo "#define MODULE_NAMES \"$(MODULE_NAMES)\"" > preopened.h

    AC_MSG_CHECKING(for modules to preload)
    default_preload='foo bar baz'

      [AC_HELP_STRING([--with-modules=MODULES], [preload MODULES])],

    DLPREOPEN="-dlpreopen force"
    if test -z "$use_modules"; then
    elif test "$use_modules" != yes; then
      for module in $use_modules; do
        DLPREOPEN="$DLPREOPEN -dlpreopen ../modules/$"
        MODULE_NAMES="$MODULE_NAMES $module"

Maybe you can persuade us that API support for this would be good, and supply us with a patch to implement it? It should just be a simple matter of walking through lt_preloaded_symbols and looking for elements with NULL addresses (these are the module names, or @SELF@ for dlpreopened self).

  ())_.  Gary V. Vaughan    gary@(|
  ( '/   Research Scientist       ,_())____
  / )=   GNU Hacker  \'      `&
`(_~)_   Tech' Author   =`---d__/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]