Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I try to load 'nppdf.so' library #include <dlfcn.h> #include <iostream> using namespace std; int main() { cerr << "Loading library..." << endl; void *handle = dlopen("/usr/local/Acrobat5/Browsers/intellinux/nppdf.so", RTLD_LAZY); if (handle) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Posts
    1

    How to load .so libs?


    Hi,
    I try to load 'nppdf.so' library

    #include <dlfcn.h>
    #include <iostream>
    using namespace std;

    int main()
    {
    cerr << "Loading library..." << endl;
    void *handle = dlopen("/usr/local/Acrobat5/Browsers/intellinux/nppdf.so", RTLD_LAZY);

    if (handle)
    {
    cerr << "Unloading library..." << endl;
    dlclose(handle);
    return 0;
    }

    cerr << "error: " << dlerror() << endl;

    return 0;
    }

    but when I run this program I get an error "/usr/local/Acrobat5/Browsers/intellinux/nppdf.so: undefined symbol: XtStrings"

    Any ideas why?

    Do you know any alternative way (without using dlopen()) of loading ".so" libs ?

    //////////////////////////////////////////////////////
    Mozilla loads plugins in a following way
    //////////////////////////////////////////////////////
    PRLibrary *dlopen_obj;
    info->dlopen_obj = NULL;
    info->dlopen_obj = NULL;
    if (plugin->dlopen_obj == NULL) {
    plugin->dlopen_obj = PR_LoadLibrary(plugin->filename);
    if (plugin->dlopen_obj == NULL) {
    (NP_CREATEPLUGIN)PR_FindSymbol("NP_CreatePlugin", plugin->dlopen_obj);
    (NP_CREATEPLUGIN)PR_FindSymbol(plugin->dlopen_obj, "NP_CreatePlugin");
    int err = PR_UnloadLibrary(plugin->dlopen_obj);
    plugin->dlopen_obj = NULL;
    f = (NPError(*)(NPNetscapeFuncs *, NPPluginFuncs *)) PR_FindSymbol("NP_Initialize", plugin->dlopen_obj);
    f = (NPError(*)(NPNetscapeFuncs *, NPPluginFuncs *)) PR_FindSymbol(plugin->dlopen_obj, "NP_Initialize");
    int err = PR_UnloadLibrary(plugin->dlopen_obj);
    plugin->dlopen_obj = NULL;
    int err = PR_UnloadLibrary(plugin->dlopen_obj);
    plugin->dlopen_obj = NULL;
    plugin->shutdown = (NPError(*)(void)) PR_FindSymbol("NP_Shutdown", plugin->dlopen_obj);
    plugin->shutdown = (NPError(*)(void)) PR_FindSymbol(plugin->dlopen_obj, "NP_Shutdown");
    int err = PR_UnloadLibrary(plugin->dlopen_obj);
    plugin->dlopen_obj = NULL;
    /////////////////////////////////////////////////////
    but I can't find definition of PRLibrary, PR_LoadLibrary(), PR_UnloadLibrary() in Mozilla's source code. It seems that plugin is loading without dlopen.

    Does anybody know how to load plugins (HOWTO or tutorial)?

    Thanks in advance
    ebleble

  2. #2
    Just Joined!
    Join Date
    May 2004
    Location
    Malta
    Posts
    41
    I kinda asked the same question yesterday... here's the link

    http://www.ibiblio.org/pub/Linux/doc...ary-HOWTO.html


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •