Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda