From: Ian Lance Taylor <iant@google.com>
To: f.b.brokken@rug.nl
Cc: George Danchev <danchev@spnet.net>,
gcc-help@gcc.gnu.org, tony mancill <tmancill@debian.org>
Subject: Re: missing symbols with bobcat C++ library on armel
Date: Wed, 25 May 2011 16:13:00 -0000 [thread overview]
Message-ID: <mcr8vtudehj.fsf@coign.corp.google.com> (raw)
In-Reply-To: <20110525134815.GD31243@suffix.rc.rug.nl> (Frank B. Brokken's message of "Wed, 25 May 2011 15:48:15 +0200")
"Frank B. Brokken" <f.b.brokken@rug.nl> writes:
> class MultiStreambuf: public std::streambuf
> {
> public:
> enum Mode
> {
> OFF, // stream not used
> ON, // stream always used
> ONCE, // stream used until flushed
> RESET, // stream once used. Set to ONCE to re-use
> };
>
> class stream // holds a pointer to a stream and a indicator
> { // telling us whether or not to use the stream
> friend class MultiStreambuf;
>
> std::ostream *d_os;
> Mode d_mode;
>
> public:
> stream(std::ostream &os, Mode mode = ON);
> void setMode(Mode mode);
> Mode mode() const;
> std::ostream &ostream();
> private:
> static void setOnce(stream &os);
> };
>
> typedef std::vector<stream>::iterator iterator;
> typedef std::vector<stream>::const_iterator const_iterator;
>
> private:
> std::string d_buffer;
> std::vector<stream> d_os;
>
> public:
> MultiStreambuf() = default;
> explicit MultiStreambuf(std::ostream &os, Mode mode = ON);
> explicit MultiStreambuf(std::vector<stream> const &osvector);
>
> void insert(std::ostream &os, Mode mode = ON);
> void insert(std::vector<stream> const &os);
> iterator begin();
> iterator end();
> const_iterator begin() const;
> const_iterator end() const;
> void setOnce(); // reset all `RESET' modes to `ONCE'
>
> protected:
> int pSync();
>
> private:
> virtual int overflow(int c);
> virtual std::streamsize xsputn(char const *buffer, std::streamsize n);
> virtual int sync();
>
> struct Insert
> {
> std::string &buffer;
> bool ok;
> };
> static void insertStruct(stream &os, Insert &insert);
> };
OK, so the key method should be overflow.
> You won't see the implementations of the private virtual members here, as they
> are provided in the following header file, which is included by
> MultiStreambuf's sources:
>
> -------------------------------------------------------
> #include "multistreambuf"
>
> #include <algorithm>
> #include <bobcat/fnwrap>
>
> using namespace FBB;
>
> inline std::streamsize MultiStreambuf::xsputn(char const *buffer,
> std::streamsize n)
> {
> d_buffer.append(buffer, n);
> return n;
> }
>
> inline int MultiStreambuf::sync()
> {
> return pSync();
> }
>
> inline int MultiStreambuf::overflow(int c)
> {
> if (c == EOF)
> pSync();
> else
> d_buffer += c;
>
> return c;
> }
> -------------------------------------------------------
This approach will only work if you guarantee that every piece of code
that creates a new MultiStreambuf includes that header file.
> Since it looks like armel's compiler skips the inline definitions of virtual
> members when compiling for a shared library, we're in the process of removing
> all inline definitions of virtual members, replacing them by non-inline
> definitions in separate source files. From tests done so far by George Danchev
> we get the impression that this might very well solve (or bypass?) the issue.
Yes, that should work.
Ian
next prev parent reply other threads:[~2011-05-25 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 8:30 George Danchev
2011-05-25 13:48 ` Ian Lance Taylor
2011-05-25 15:14 ` Frank B. Brokken
2011-05-25 16:13 ` Ian Lance Taylor [this message]
2011-05-25 18:22 ` Frank B. Brokken
2011-05-25 18:43 ` Ian Lance Taylor
2011-05-25 19:10 ` Axel Freyn
2011-05-25 22:33 ` Frank B. Brokken
2011-05-27 8:13 ` George Danchev
2011-05-27 13:39 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcr8vtudehj.fsf@coign.corp.google.com \
--to=iant@google.com \
--cc=danchev@spnet.net \
--cc=f.b.brokken@rug.nl \
--cc=gcc-help@gcc.gnu.org \
--cc=tmancill@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).