This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linker Problems


Hi Everyone !

I hope one of you will be able to help me because I am running out of
ideas... 

Currently I am in the process of rewriting the GNU Xlogmaster Project
and it was very obvious that creating a library for shared functions
would be a very good idea.

Until recently everything worked fine... then I started using the
POSIX regex functions (regcomp, regfree, regexec and regerror) in the
library.

What I have now is that the library compiles and links fine but when
trying to link the program I get a lot of


../../libxlogmaster/src/.libs/libxlogmaster.so: undefined reference to `regexec(re_pattern_buffer const *, char const *, unsigned int, regmatch_t *, int)'
../../libxlogmaster/src/.libs/libxlogmaster.so: undefined reference to `regcomp(re_pattern_buffer *, char const *, int)'
../../libxlogmaster/src/.libs/libxlogmaster.so: undefined reference to `regerror(int, re_pattern_buffer const *, char *, unsigned int)'
../../libxlogmaster/src/.libs/libxlogmaster.so: undefined reference to `regfree(re_pattern_buffer *)'
collect2: ld returned 1 exit status


errors.

Well - the functions are used in the proper way and they are properly
defined in the libc. When commenting out just these functions and
using them in the main program instead, everything works fine.

When defining Regexec, Regcomp, Regfree, Regerror wrappers in the main
program (they just do a "return <original function>(<parameters>)" and
calling these wrappers from the library, everything works fine, too.

It would seem that the error is somewhere in the difference between a
program and a library... so libtool seems like a likely candidate (to
finally arrive where I was getting at).

The library is using C++ code (some things are done better with
classes) and I start suspecting that this error might be related to
it - although I donīt really see how.

By now I am pretty much willing to believe in black magic because this
is just strange. Since this is my first library it is possible that I
am missing something painfully obvious although I donīt think so.

Well - maybe one of you will have an idea...


Regards,
		Georg


--
Georg C. F. Greve <greve@gnu.org>
"Brave GNU World", the monthly GNU forum
in English, German, French and Japanese. Check
it out at http://www.gnu.org/brave-gnu-world/

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]