Linking a shared library into libbackend.a?
Guy Montag
theguymontag@yahoo.com
Sat Aug 31 21:43:00 GMT 2002
--- Guy Montag <theguymontag@yahoo.com> wrote:
> 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++
>
Problem solved. The LIBS variable appears to be well
situated to add in a .lhook flag to compile in the
shared library. I recompiled G++ with the change and
it works.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
More information about the Gcc
mailing list