Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2007-09-14 16:15:16


Below is a little program, made up of two files. It's a reduction of
code causing filesystem crashes when compiled with g++ on some, but not
all, platforms that gcc supports. It works fine with other compilers.

The static version works fine, even with g++, and outputs "all's well
that ends well".

dll_test stackdumps at the line marked with the comment.

Does anyone know what's going on here? Am I supposed to be passing some
additional options to g++ when building or using shared libraries?

Thanks,

--Beman

callee.cpp
==========

#include <string>

void f( std::string & s )
{
   s = "all's well that ends well"; // dll_test crash!
}

caller.cpp
==========

#include <string>
#include <iostream>

void f( std::string & s );

int main()
{
   std::string s;
   f(s);
   std::cout << s << std::endl;
   return 0;
}

Compile and test (cygwin)
=========================

g++ -o static_test caller.cpp callee.cpp
static_test

g++ -c callee.cpp
g++ -shared -o callee.dll callee.o
g++ -o dll_test caller.cpp -L./ -lcallee
dll_test


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk