Menu

tcp.cpp crashes under .NET

Porting
2002-05-02
2002-06-11
  • Anders Backman

    Anders Backman - 2002-05-02

    Hi all.
    I have a couple of open issues now under the header: "Visual Studio .NET vs. CommonC++"

    The demo application tcp.cpp crashes when compiled with .NET.

    It seems to be inside the iostream library
    during the call to:

    tcp << "welcome to " << addr << endl;
    in the file: ostream:

    Unhandled exception at 0x004693c0 (msvcp70d.dll) in tcptest1.exe: 0xC0000005: Access violation reading location 0x00000004.
    Line 554 of ostream.

    The STL implementation is new in VisualStudio .NET  and this seems to be causing all the *streams classes in CommonC++ to crash.
    Threads, UDP sockets etc works. but not anything that has to do with streams.

     
    • Frediano Ziglio

      Frediano Ziglio - 2002-05-02

      I don't have .NET to make some test myself.
      Try to append a line
      #define HAVE_OLD_IOSTREAM
      in win32/cc++/config.h and rebuild all.

      freddy77

       
    • Anders Backman

      Anders Backman - 2002-05-02

      Tried that. Got:

      c:\Tools\commoncpp2-0.99.2\src\slog.cpp(68): error C2512: 'std::basic_ostream<_Elem,_Traits>' : no appropriate default constructor available
              with
              [
                  _Elem=char,
                  _Traits=std::char_traits<char>
              ]

      Also, I tried to use STLPort 4.5.3, with STLPorts iostream library, and voila that works.
      But then I found a bug in STLPort :-( that generates a INTERNAL error in the .NET compiler.

      Using STLPort is not the way I want to go. That would require all my (and others library) to be recompiled with STLPort.

      Also, there are a large number of compiling problems when using .NET. I have to hack around in the CommonC++ socket.h and url.h to make it compile. (some default copy constructors that generates error etc...)
      So I would say that .NET is not working at all with CommonC++ right now, which is a HUGE problem for me. Im stuck. Sort of...

       
    • Ronald Fenner Jr

      After snooping aorund and comparing the .Net ios file vs. the VC++6 ios file the problem lies in the copy constructor for basic_ios
      in VC6 it's declared as:
      public:
      basic_ios(const _Myt& _R)
      {init(0), *this = _R;}

      but in the .Net ios file it's:
      private:
      basic_ios(const Myt&); // not defined.

      the part that is tripping this is the TCPStream copy constructor. If you comment the copy constructor out it will compile but then you get the link errors relating to the define that declares this: __declspec(dllimport).

      Hopefully this info will help you(the developers) with fixing the problems or someone else might know how to fix the problem so that it will compile under .Net.

      Once these 2 problems are worked out it should have no problem compiling under .Net.

       
      • Frediano Ziglio

        Frediano Ziglio - 2002-06-11

        Already fixed in CVS.
        CVS are now located at savannah (see savannah.gnu.org/projects/commoncpp)

        freddy77

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.