Problem mit .so und GNU Compiler



  • Hallo Leute hab ein Problem mit dem GNU Compiler.Wenn ich mit dem Aufruf gcc eine Libary(.so) erstelle dann sind die Objekte dort drinnen alle ganz normal definiert. Eine Funktion void hallo() wird dann auch zu 0000000 T hallo.
    Wenn ich das ganze aber mit g++ compiliere (später nötig da c++ programm) dann sieht das Objekt etwa so aus 000000 T _Z5hallov. wie kann ich das verhindern oder get das überhaupt?
    Danke



  • jo, mit extern "C"

    #ifdef __cplusplus
    extern "C" {
    #endif
    
    void hallo() {
      puts("hallo welt!");
    }
    
    #ifdef __cplusplus
    }
    #endif
    

    das Problem liegt nämlich bei der C++ Namensgebung, die für den Support von Funktions Überladung eingeführt wurde.


Anmelden zum Antworten