Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
Will a C compiled .so work with a C++ application?

If I want to dynamically link a shared library (.so) for a C++ application (which was built with g++) using LD_PRELOAD, does it matter if the .so is generated from a C source file (using gcc) or a C++ source file (using g++)? And why or why not?

Thanks for helping me understand this.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Yes, a C++ executable can be linked (both statically and dynamically) to a C library.

This is completely deliberate. The C++ ABIs are designed to be backwards compatible.

You will have to ensure that the declarations of functions and so on of the library symbols, as written in your C++ program, are marked extern "C" to denote that you are crossing a language boundary. Typically, the library's own shipped header files will do this for you.

over 4 years ago · Santiago Trujillo Denunciar

0

It doesn't matter how an .so was generated. You should be able preload an .so that was generated from FORTRAN code too. The key issue is making sure that you use the symbols in the .so correctly.

When an .so is generated from C code, the names of the symbols are unmangled.

When an .so is generated from C++ code, the names of the symbols are mangled.

I am not sure whether the names of symbols in an .so generated from FORTRAN are mangled.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda