[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Shared libraries med C++



On Fri, 28 Jul 2000 19:19:46 +0200, Jarl Erik Gjessing <sslug@sslug> wrote:

>Jeg er ved, at programmere et EDA toolkit til Linux, men jeg har nogle
>kæmpe problemer med, at få lavet plugins til det.
>Jeg laver det i QT, og librarierne skal kunne vise QWidgets af
>forskællige slags, og skal derfor være C++ filer.
>Jeg har prøvet at lave nogle C libraries som loades godt nog dynamisk,
>men så snart jeg konverterert dem over til C++, så får jeg "undefined
>symbol: <symbol navn>".

Der var ingen attachment med dit brev -- maaske fordi jeg laeser via
newsserveren, men jeg vil skyde paa at dit problem skyldes C++'s "name
mangling". Pga. overloading i C++ kan en funktion som "foo" ikke bare hedde
"foo", fordi der kunne vaere baade en int foo(char*) og en int foo(Bar*).

Funktionerne kommer derfor til at hedde noget i stil med
getPreallocStartCount__Ct9Allocator1Z13ChangelogNode eller vaerre :)

Du kan:

1) bruge "nm" programmet paa din objektfil til at finde ud af hvad fuaktionen
*egentlig* hedder og saa kalde dlsym() med dette manglede navn

2) putte extern "C" { ... } omkring fuktionen definition

Det sidste faar compileren til at bruge C-stil funktionsnavne, altsaa bare
"foo" for en funktion der hedder foo. Det er nok den letteste loesning -- men
betyder saa at hvis du tilgaar funktionen fra andre C++ filer, skal du ogsaa
putte extern "C" omkring prototypen der.



-- 
=======================================================================
<sslug@sslug>           Herlev, Denmark       Software Designer
<URL:http://www.andreasen.org/>       <*>                LASAT Networks
=======================================================================


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *