shared libs statisch linken



  • Hallo zusammen,

    ich versuche, shared libs statisch zu linken, da ich auf dem Zielsystem keinen Zugriff auf die Standard - Lib - Verzeichnisse habe (Fritzbox, readonly - Linux FS). Im Prinzip klappt das, allerdings kann ich ein Treibermodul nicht laden. Der Programmierer hat folgenden Hint in den Sourcecode eingebaut:

    /**
           * Load the driver module and call the init function "InitYasdiModule"
           * of it...
           * 
           * If your system have no dynamic libaries overload the functions
           * "os_LoadLibrary()" and "os_FindLibrarySymbol()"
           * in the "os specific include file"
           * to use an static version where all modules are already linked
           * to the main program...
           * 
          * So, we do not need to change something here to use static libs...
          */
    

    Die referenzierten Wrapper-Funkitionen sind folgende:

    DLLHANDLE os_LoadLibrary(char * file)
    {
       //all libryries must be prefixed with "lib" and extended with ".so" on linux
       DLLHANDLE h;
       char tmp[ strlen(SHAREDLIB_EXT) + strlen(SHAREDLIB_PREFIX) + strlen(file) + 2 ];
       tmp[0] = 0;
    
       assert(file);
    
       //check prefix...(and add)
       if(strstr(file, SHAREDLIB_PREFIX) != file)
          strcat(tmp, SHAREDLIB_PREFIX); //add it...
    
       //add filename
       strcat(tmp, file);
    
       //if no shared lib extension, than add it..
       if(strstr(file, SHAREDLIB_EXT) == NULL)
          strcat(tmp, SHAREDLIB_EXT);
       //printf("try to load lib '%s'\n", tmp);
       h = (DLLHANDLE)dlopen(tmp, RTLD_LAZY);
       return h;
    }
    
    void * os_FindLibrarySymbol(DLLHANDLE handle, char * ident)
    {
       return dlsym((void*)handle, ident);
    }
    

    Mir ist nun nicht ganz klar, was der Author mit dem Satz
    "overload the functions
    * "os_LoadLibrary()" and "os_FindLibrarySymbol()"
    * in the "os specific include file"
    meint. Was soll ich da machen, dass ich die Funktionen der statisch gelinkten lib aufrufen kann?

    Vielen Dank,
    NoClue



  • Dieser Thread wurde von Moderator/in rüdiger aus dem Forum ANSI C in das Forum Compiler- und IDE-Forum verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.


Anmelden zum Antworten