Mail Archives: cygwin/2001/03/09/15:27:03
Below is a set of sources for a simple program and dll. The dll contains
a static stl list. No operations are ever performed on this list, except
that it is constructed and destructed. When the the program exits, the
list's destructor is called, and it crashes (I'm fairly hazy on stl
internals, but my guess is that the list isn't constructed properly).
This crash doesn't occur if the list isn't inside a dll.
To see this in operation, extract the files, and then type make.
dllcheck (which has the list in a dll) will crash. Any ideas on what's
wrong or how to fix it?
Files follow.
Thanks,
Sterling
sterling AT tensilica DOT com
>>>>>>>>>>>>>>>>
#Makefile to see an stl list inside a dll crash on deconstruction
dllcheck: bar.dll foo.o Makefile
g++ -v -o dllcheck bar.dll foo.o
foo.o: foo.cxx
g++ -MD -g -c foo.cxx -o foo.o
bar.o: bar.cxx
g++ -MD -g -c bar.cxx -o bar.o
bar.dll: bar.o
dllwrap --driver-name /usr/bin/g++.exe -target=i386-cygwin32
--export-all bar.o --dllname bar.dll
clean:
rm -f bar.dll bar.o foo.o *.exe *~ *.d
>>>>>>>>>>>>>>>>>>>>
/* bar.cxx:
the dll file. alist's deconstruction will cause a segfault
*/
#include <list>
list <int> alist;
__declspec(dllexport) void do_nothing()
{
}
>>>>>>>>>>>>>>>>>>
/* foo.cxx:
the main program. Note that it doesn't refer to the list.
*/
extern __declspec(dllimport) void do_nothing(void);
int main()
{
do_nothing();
}
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -