Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Solaris/g++ linking problems

>I suspect that g++ uses a different name mangling convention than the
>Sun compiler that created the *.so files. Is this a reasonable
>diagnosis? Is there anything that can convert the *.so files into
>something that I can use?

Yes, you are right.

If you'd know the declarations of the problematic symbols, then you
could trick the compiler into thinking they are plain C external
symbols. For example, a function declared in C++ like this

void myfunc(int n, double x, char c);

will be mangled "_myfunc__Fidc" and then you put this declaration
in your source

extern "C" {
void myfunc__Fidc(int n, double x, char c);
// remove the leading underscore to bypass C mangling
}

You can learn the Sun-style mangled names from the error messages.
To avoid spoiling the source code you can use macros,

#define myfunc myfunc__Fidc

This can be a lot of work if there are many functions, but I can't
see any other way.

But unfortunately this will not be the only problem you'll encounter.
The use of scratch registers, the layout of classes, virtual tables,
virtual inheritance, etc., all this could be implemented in a
different way in each compiler, so the program will be linked ok, but
it will crash later. In practice, however, most compilers make the
same layout for lightweight classes (no virtual tables, no virtual
inheritance), and this is specially so in this case because both
compilers run on the same platform, so it's possible that you succeed
using the trick above (but don't count on it).

Regards.

José Juan Mendoza Rodríguez

Report this thread to moderator Post Follow-up to this message
Old Post
Jose Juan Mendoza Rodriguez
09-08-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compilers archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:04 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.