iamhwani / v8-juice

Automatically exported from code.google.com/p/v8-juice
Other
0 stars 0 forks source link

Default constructor error for WHIO StdI/OStream classes #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1) Trying to compile the WHIO plugin for V8-convert.
2) Compiling error with MSVC.  Not sure if this is an MSVC issue or a general 
standards issue.

Compiler complains that there is no appropriate default constructor for classes 
such as StdOStream in whio_amalgamation_cpp.cpp

What is the expected output? What do you see instead?
Expected output is that the constructor uses the correct default constructor 
for std::ostream or std::istream.  Example constructor looks like:

StdOStream::StdOStream( whio_stream * proxy, bool ownsWh, uint32_t bufferSize )
    :   m_buf( *this, proxy, ownsWh, bufferSize )
    {
    }

The following kills the compiler error:

StdOStream::StdOStream( whio_stream * proxy, bool ownsWh, uint32_t bufferSize )
    :   m_buf( *this, proxy, ownsWh, bufferSize )
    ,   std::ostream(0)     
    {
    }

However, I don't know if using ostream(0) is a problematic default 
construction?  This may not be the solution to the problem even if the compiler 
error goes away.

Exact compiler error:

.\cvv8\addons\whio\whio_amalgamation_cpp.cpp(600) : error C2512: 
'std::basic_ostream<_Elem,_Traits>' : no appropriate default constructor 
available
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]

What version of the product are you using? On what operating system?

MSVC 9 (2008) on Windows 7 x64

Please provide any additional information below.

I'm not sure if this is the fault of MSVC or a standards problem.  MSVC uses 
basic_ostream for the std::stream that the classes in question complain about:

http://msdn.microsoft.com/en-us/library/3at5becw

It seems that it is the same for GCC:

http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.2/classstd_1_1bas
ic__ostream.html

Note: I'm no expert, but this is just what I've found.

Original issue reported on code.google.com by bionicba...@gmail.com on 19 Dec 2011 at 6:47

GoogleCodeExporter commented 9 years ago
Hi!

First off, thank you for the detailed report :).

The whio code will "almost certainly not" compile on Windows because it makes 
some small use of Posix APIs which aren't available on Windows, e.g. signal 
handling. The majority of it "should" compile on Windows but is untested, and 
some of the functionality (e.g. EPFS) won't build on Windows without some more 
#ifdefs (and someone to test them - i don't have Windows).

As for the stream constructor - i can't say off hand whether i hosed whio's use 
of the stream ctor, but i very well may have. i just happen to have an 
excellent book about the i/o stream library on my shelf and will clarify/fix 
this.

However... i unfortunately cannot commit to doing this right now. My local cvv8 
does not compile because Coen and i are in the middle of removing some rather 
invasive code and my work (and malicious system crackers) have kept me from 
doing any coding the past 8 weeks or so. It is very unlikely that i will be 
able to spend any time fixing it for at least another 10 days or so. i 
apologize for that, but the timing is particularly bad for me.

In any case, you'll get a mail from google when this ticket has been updated.

Original comment by sgbeal@googlemail.com on 19 Dec 2011 at 6:46

GoogleCodeExporter commented 9 years ago
No problem!  Eventually, I got it to compile on Windows after applying those 
constructor fixes and using a lot of compatibility include files to imitate 
POSIX.   I really wanted some file-IO functionality in my little v8 shell.  It 
does what I want for now (just simple text readline and write); however, I 
haven't tested the other features extensively to see if using a null stream is 
proper.

I can also provide the includes/source-of-includes and documentation on how to 
make the plugin work with MSVC.  With exception to getopt.h/.c most of the 
compatibility fixes comprise providing defines, or can just be gated away.

Thanks!

Original comment by bionicba...@gmail.com on 20 Dec 2011 at 12:29

GoogleCodeExporter commented 9 years ago
Hi, Badger!

Any additions/fixes/patches are of course happily received! Just attach them to 
the report or feel free to email them to me (sgbeal googlemail.com) or our list 
(v8-juice-js-dev@googlegroups.com). i will be out of town much of the next 10 
days but will get around to the stream constructor stuff (and any additional 
code you have) as soon as i get some time to hack. Unfortunately, my employers 
consider their PHP/JS code to be much more important than my C++ code :(.

Original comment by sgbeal@googlemail.com on 20 Dec 2011 at 4:15

GoogleCodeExporter commented 9 years ago
The fix is in place in the whio source tree but needs to be ported in here 
(hopefully this coming weekend).

Original comment by sgbeal@googlemail.com on 15 Feb 2012 at 7:43

GoogleCodeExporter commented 9 years ago
Badger's patches were committed in r2181.

Original comment by sgbeal@googlemail.com on 17 Feb 2012 at 8:25