This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Linking a shared library into libbackend.a?
- From: Guy Montag <theguymontag at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 31 Aug 2002 16:37:21 -0700 (PDT)
- Subject: Linking a shared library into libbackend.a?
I have written a hook directly into
rest_of_compilation in toplev.o. I would like this
hook to be present for the entire compiler proper. I
understand perfectly well how to add in an unlinked
object file, under “EXTRA_OBJS.” The challenge is that
the hook is written in C++. I have to compile and link
the object file with libstdc++, creating libhook.so.
When I add in this file into EXTRA_OBJS, the compiler
complains:
./cc1: relocation error: ./cc1: undefined symbol: hook
I am afraid that I do not yet have the knowledge to
identify why the shared library isn't working. I also
do not know where I might add in the flags “.L/.
-lhook” to directly tell GCC what to do.
Any help would be GREATLY appreciated!!!
-Guy
hook.h
int hook(void);
hook.cpp
#include <iostream>
extern "C" int hook() {...}
gcc -fpic -c hook.cpp
gcc -shared -o libhook.so hook.o -lstdc++
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com