From: geier AT forwiss DOT uni-passau DOT de (Roland Geier) Subject: Exporting c++-classes from dll? 16 Jun 1997 14:55:59 -0700 Sender: mail AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199706161254.OAA04892.cygnus.gnu-win32@bombadill.forwiss.uni-passau.de> Original-To: gnu-win32 AT cygnus DOT com X-Face: %JjDwL,CM#gbv*uICrNLdM9yk_LRxMh3DV'.fQ>iw'N;7([Jq}2|J#5o".kzM&>7tW`8T^Z buvRLp?jvQ+sbD3BND%=&D: lT%vT4p7cGcGRP5JO+F'^ X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Original-Sender: owner-gnu-win32 AT cygnus DOT com Hi! I'm trying to port a c++-project from Unix to NT4.0 using b18. Thereby I use a Date/Time-package consisting of several classes dealing with Dates and Times (class Date, class Time, class Month and so on). Each of this classes is packed into a separate Module (.cc/.h-File). There's no problem compiling those modules into '.o'-Files, but don't get them packed into a single dll. After compiling I'm using the following commands to build a dll: --------------------- cut here --------------------- if [ ! -f fixup.o ]; then echo 'asm (".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0");' >fixup.cc g++ -c fixup.cc fi; # --- create a temporary archive ar rs tmp.a *.o # --- create .def-File echo EXPORTS > DateTime.def nm tmp.a | egrep " [CT] " | sed s/.........T._//g >xxx.tmp sed s/.........C._//g q.scr >> DateTime.def rm -f xxx.tmp g++ -s -v -nostartfiles -Wl,--dll -e _dll_entry AT 12 -o tmp.dll -Wl,--base-file=tmp.base *.o --------------------- cut here --------------------- The DateTime.def-File looks like the following: --------------------- cut here --------------------- EXPORTS BreakDown__C4DateRiR7WeekDayR5MonthT1 First__4Date GetDateStr__4Date GetMDay__C4Date GetMonth__C4Date GetPureDateStr__4Date GetRep__4DateiG5Monthi GetWDay__C4Date GetYear__C4Date InitializeEpoch__4Date Last__4Date SetDateFromChar__4DatePc SetDateFromInt__4Dateiii Today__4Date __4DateG4Time __4DatePc __4DateiG5Monthi __4Dateiii Datetime_Init dll_entry AT 12 Offset__5Monthi Size__5Monthi : : --------------------- cut here --------------------- The link-stage outputs the following: --------------------- cut here --------------------- Reading specs from C:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404\specs gcc version cygnus-2.7.2-970404 C:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404\../../../../i386-cygwin32\bin\ld.exe -o tmp.dll -e dll_entry AT 12 -s -LC:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404 -LC:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib -LC:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404\../../../../i386-cygwin32\lib -LC:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2 ..7.2-970404\../../.. --dll --base-file=tmp.base Date.o DateTimePkgInit.o Month.o Time.o TinyTime.o WeekDay.o Year.o fixup.o -lstdc++ -lm -lgcc -lcygwin -lkernel32 -lgcc Date.o: In function `Date::GetRep(int, Month, int)': /home/project/packages/cms++-2.0/src/types/Date.cc:18: undefined reference to `GLOBAL_OFFSET_TABLE_' /home/project/packages/cms++-2.0/src/types/Date.cc:19: undefined reference to `Offset__4Yeari AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:19: undefined reference to `Offset__5Monthi AT PLT' Date.o: In function `_4DateiG5Monthi': /home/project/packages/cms++-2.0/src/types/Date.cc:22: undefined reference to `GLOBAL_OFFSET_TABLE_' /home/project/packages/cms++-2.0/src/types/Date.cc:23: undefined reference to `__5MonthRC5Month AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:23: undefined reference to `GetRep__4DateiG5Monthi AT PLT' Date.o: In function `_4Dateiii': /home/project/packages/cms++-2.0/src/types/Date.cc:27: undefined reference to `GLOBAL_OFFSET_TABLE_' /home/project/packages/cms++-2.0/src/types/Date.cc:28: undefined reference to `__5Monthi AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:29: undefined reference to `__5MonthRC5Month AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:29: undefined reference to `GetRep__4DateiG5Monthi AT PLT' Date.o: In function `_4DatePc': /home/project/packages/cms++-2.0/src/types/Date.cc:31: undefined reference to `GLOBAL_OFFSET_TABLE_' /home/project/packages/cms++-2.0/src/types/Date.cc:34: undefined reference to `strlen AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:34: undefined reference to `strlen AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:34: undefined reference to `__assert AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:36: undefined reference to `strcpy AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:37: undefined reference to `strtok AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:38: undefined reference to `strtok AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:39: undefined reference to `strtok AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:40: undefined reference to `atoi AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:41: undefined reference to `atoi AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:42: undefined reference to `atoi AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:43: undefined reference to `strlen AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:54: undefined reference to `__5Monthi AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:55: undefined reference to `__5MonthRC5Month AT PLT' /home/project/packages/cms++-2.0/src/types/Date.cc:55: undefined reference to `GetRep__4DateiG5Monthi AT PLT' Date.o: In function `_4DateG4Time': /home/project/packages/cms++-2.0/src/types/Date.cc:58: undefined reference to `GLOBAL_OFFSET_TABLE_' --------------------- cut here --------------------- Could anybody help me to find out what's going on there? Is there a general description how to build dlls containing c++-classes? Many thx in advance for every suggestion, --- Roland. --- Roland Geier Phone: ++49 (8505) 92181 Universitaet Passau, GER Lehrstuhl Prof. Dr. Donner geier AT forwiss DOT uni-passau DOT de D-94032 Passau http://www.uni-passau.de/~geier/ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".