This is the mail archive of the
mailing list for the GCC project.
Re: Bizarre symbol names generated by g++
- From: Karel Gardas <kgardas at objectsecurity dot com>
- To: Paul Harman <paul dot harman at pa dot press dot net>
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Fri, 26 Sep 2003 13:54:24 +0200 (CEST)
- Subject: Re: Bizarre symbol names generated by g++
On Fri, 26 Sep 2003, Paul Harman wrote:
> These are probably very silly newbie questions, but I've been unable to get
> anything meaningful out of the mailing list's search engine...
> I'm having difficulties understanding the symbol names created by g++ when
> compiling C++ source code. I'm running g++ 3.2.1 on Solaris 2.8
> When I compile a simple function like this:
> bool render(node* aNode, struct gv__ContentItem &rendered);
> ... I don't get a symbol "render", I get this:
> ...which is complicating my life a bit because I was hoping to use these
> functions in a dynamic library. dlsym() works okay if passed that label...
> but it's not a particularly pretty or understandable thing to look at!
Use extern "C" block and declare some initialization function inside it.
Then when you load your module, call this function and it will be able to
call all your object initialization machinery.
BTW: Please consider that calling C++ generated symbols directly is not
portable between various compilers and even between the same compiler, but
different version. (e.g. gcc2.95.x contra gcc3.x)
Karel Gardas email@example.com
ObjectSecurity Ltd. http://www.objectsecurity.com