Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-09-25 11:41:22


Alexander Nasonov wrote:

> David Abrahams wrote:
>> In the meantime, have you checked whether implementations
>> actually support this? It would seem to incur a serious penalty for
>> inline functions at link time.
>
> g++ 3.3.1 under linux works fine only if only *.o files were linked. If
> *.a file is used, I don't see any objects from this file in the
> static_list. If the program is linked with *.so file I get SIGSERV.
> Similar results with Intel 6.0 under linux :(

Sorry, it was something wrong a build instruction. *.so seems fine with g++.

[root_at_sat-pc test_mtu]# make clean test_so
rm -f test_a test_o test_so *.o *.a *.so
g++ -I.. -I/usr/local/src/boost -c main.cpp -o main.o
g++ -I.. -I/usr/local/src/boost -c other.cpp -o other.o
g++ -L. other.o -shared -o libother.so
g++ -L. main.o -lother -o test_so
ldconfig

[root_at_sat-pc test_mtu]# ldd ./test_so
        libother.so => /home/alnsn/usr/lib/libother.so (0x4002d000)
        libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 (0x40030000)
        libm.so.6 => /lib/i686/libm.so.6 (0x400e9000)
        libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x4010b000)
        libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

[root_at_sat-pc test_mtu]# file /home/alnsn/usr/lib/libother.so
/home/alnsn/usr/lib/libother.so: symbolic link to
/home/alnsn/src/cpp-experiment/static_list/test_mtu/libother.so

[root_at_sat-pc test_mtu]# pwd
/home/alnsn/src/cpp-experiment/static_list/test_mtu

[root_at_sat-pc test_mtu]# ./test_so
size: 6 elements: 2 1 0 5 4 3

[root_at_sat-pc test_mtu]# cat main.cpp
#include "static_list.hpp"

#include <iostream>
#include <algorithm>
#include <boost/lambda/lambda.hpp>

// void activate_other();

boost::static_list<int>::insert element0(0);
boost::static_list<int>::insert element1(1);
boost::static_list<int>::insert element2(2);

int main()
{
// activate_other();
    boost::static_list<int> l;
    boost::lambda::placeholder1_type x;

    std::cout << "size: " << l.size() << " elements: ";

    std::for_each(l.begin(), l.end(), std::cout << x << ' ');

    std::cout << '\n';
}

[root_at_sat-pc test_mtu]# cat other.cpp
#include "static_list.hpp"

boost::static_list<int>::insert element3(3);
boost::static_list<int>::insert element4(4);
boost::static_list<int>::insert element5(5);

void activate_other()
{
}

--
Alexander Nasonov
Remove minus and all between minus and at from my e-mail for timely response

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