This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
Problems with relocatable links fom C++ - modules
- To: "'cygwin at sourceware dot cygnus dot com'" <cygwin at sourceware dot cygnus dot com>
- Subject: Problems with relocatable links fom C++ - modules
- From: "Junkes Uwe (AT/ESA2)" <Uwe dot Junkes at de dot bosch dot com>
- Date: Thu, 26 Oct 2000 15:21:44 +0200
- Cc: "Egner Armin (AT/ESA2) *" <Armin dot Egner at de dot bosch dot com>
Hello,
I use the Cygwin V1.0 on WIN/NT-4.0 and have a problem by generating
relocatable links for C++ - modules ( virtual functions).
I send you a short example and hope somebody can solve my problem.
//
// Module test1.cc
//
#include "test1.hh"
int CCTest1::init(int name)
{
return 0;
}
void main()
{
};
**************************************
**************************************
//
//Module test1.hh
//
class CCTest1
{
public:
virtual int init (int name);
};
**************************************
**************************************
//
// Module test2.cc
//
#include "test1.hh"
#include "test2.hh"
CCTest2 bsp2;
int CCTest2::init(int name)
{
return 0;
}
void TES_Test2Init(int phase)
{
bsp2.init(1);
}
**************************************
**************************************
//
// Module test2.hh
//
class CCTest2 : public CCTest1
{
public:
int init (int name);
};
First I compile the source files :
gcc -c -o test1.o test1.cc
gcc -c -o test2.o test2.cc
Then I generate two relocatable objects:
ld -r -o test1_fun.o test1.o
ld -r -o test2_fun.o test2.o
Then I generate the file Test:
ld -o Test /usr/i686-cygwin/lib/crt0.o
-L/usr/lib/gcc-lib/i686-cygwin/2.9-cygwin-990830 test1_fun.o test2_fun.o
-lgcc -lcygwin -lkernel32
Result :
We have no linker-errors and the file Test will be generated.
But the addresses of the functions from test2_fun.o are not correct.
Here a part of the symbol-file from Test ( nm Test ):
00404e60 T _cygwin_crt0
00404ee0 T ___main
00000020 C _TES_Test2Init__Fi
U __GLOBAL_$I$bsp2
00000000 A _bsp2
Mit freundlichen Grüßen / best regards
Uwe Junkes
Uwe Junkes,
Robert Bosch GmbH,
Berlinerstrasse 25
D 64711 Erbach/Odw.
Abt./Dep. AT/ESA
Tel. +49 (0)6062-78 686, fax. +49 (0)6062-78 771
eMail: Uwe.Junkes@de.bosch.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com