RE: [ROOT] ROOT 3.04.02 and Visual .Net

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Feb 28 2003 - 16:03:51 MET


I've made the changes suggested by Valeri for VC++6 and together with
the patches provided by Matt Langston, ROOT can now be compiled with
either VC++6 and VC++7 (.NET) and the code compiled by different
compilers can be mixed. All necessary changes are in cvs as of today.

-- Fons.



On Wed, 2003-02-26 at 21:29, Faine, Valeri wrote:
> Hello
>  I've written on VC6 vs Vc7 issue.
> 
> There are TWO different questions here.
> 
>   1. The first has nothing to do with Vc6 to VC7 migration.
>      By some historical reason the compiler that is used to compile 
>      ROOT for Windows was marked as non-ANSI compiler. 
>      That is set via RConfig.h #define R__ANSISTREAM CPP macro.
>      That entailed some problem within code. Missing flag caused 
>      few problems with VC6 but gave me a lot of problems
>      to compile the code that includes templates and C++ streams.
> 
>      Defining "R__ANSISTREAM" has helped with both compilers namely 
>      VC6 and Vc7 .
> 
>      However it gives a "side effect" mixing codes compiled 
>      With "R__ANSISTREAM" defined and the codes those were 
>      compiled with R__ANSISTREAM undefined. 
> 
>  I would like to call your attention it does NOT matter whether compiler
> 
>  was VC6 or Vc7 I DOES matter whether the compilation was performed with
>  "R__ANSISTREAM" flag "on" or "off". The reason for the troubles is 
>  the object file built-in default name of the VC<x> run-time DLL 
>  that should be loaded at run time. 
> 
>  This named is defined either "useoldio.h" or "use_ansi.h" header files
> from  the MS include directory (see the source of both files below)
>  To avoid the problem we have to migrate to "R__ANSISTREAM" flag and
> stick with that on both side I mean both the core ROOT code as well as
> the user code must be compiled in consistent way.
> 
> To assure this one has to be careful using the ROOT-provided header
> files for "streams" ONLY rather the standard ones.
> For example "Riostream.h" instead of <iostream> AND link against of the
> proper run time library. This means in the example
> $ROOTSYS/test/Makefile.win32 the file name 
> 
>            "msvcirt"  
> 
> MUST be replaced with
> 
>            "msvcprt"
> 
> My experience these two simple things namely "R__ANSISTREAM" and
> "msvcprt"
> do solve all problems and do allow to mix the codes compiled with either
> compiler.
> 
> 2. Another issue is the bugs within Vc7 compiler. I have some testes
> (ROOT macros) those gave no meaningful result with ROOT compiled with
> Vc7 and made a very good ones just I used exactly the same ROOT version
> but compiled with Vc6. Pay your attention the regular ROOT testes were
> Ok in both cases.
> 
> 
> 
> So my proposal
> 
>   1. ROOT should migrate to provide the distribution compiled with 
>           "R__ANSISTREAM"
> 
>   2. ROOT should, stay away of Vc7 till the next "Service Pack" 
> 
> ---------- Attachment ----------------
> C:\Program Files\Microsoft Visual Studio .NET\Vc7\include>dir *use*
>  Volume in drive C has no label.
>  Volume Serial Number is 7C43-7FC0
> 
>  Directory of C:\Program Files\Microsoft Visual Studio .NET\Vc7\include
> 
> 06/25/2001  08:28 PM             1,556 useoldio.h
> 06/25/2001  08:28 PM               933 use_ansi.h
>                2 File(s)          2,489 bytes
>                0 Dir(s)   1,478,737,920 bytes free
> 
> C:\Program Files\Microsoft Visual Studio .NET\Vc7\include>type
> useoldio.h
> /***
> *useoldio.h - force the use of the Microsoft "classic" iostream
> libraries.
> *
> *       Copyright (c) 1996-2001, Microsoft Corporation. All rights
> reserved.
> *
> *Purpose:
> *       Generates default library directives for the old ("classic")
> IOSTREAM
> *       libraries.  The exact name of the library specified in the
> directive
> *       depends on the compiler switches (-ML, -MT, -MD, -MLd, -MTd, and
> -MDd).
> *
> *       This header file is only included by other header files.
> *
> *       [Public]
> *
> ****/
> 
> #ifndef _USE_OLD_IOSTREAMS
> #define _USE_OLD_IOSTREAMS
> #ifndef _M_IA64
> /*
>  * Warning C4995, '_OLD_IOSTREAMS_ARE_DEPRECATED' is a deprecated name,
> is
>  * being issued because the old I/O Streams headers iostreams.h et al
> will no
>  * longer be supported from VC8.  Replace references such as #include
>  * <iostreams.h> with #include <iostreams>, using the new, more
> conformant, I/O
>  * Streams headers.
>  */
> 
> #pragma deprecated(_OLD_IOSTREAMS_ARE_DEPRECATED)
> extern void _OLD_IOSTREAMS_ARE_DEPRECATED();
> #endif  /* _M_IA64 */
> #ifdef  _MT
> #ifdef  _DLL
> #ifdef  _DEBUG
> #pragma comment(lib,"msvcirtd")
> #else   /* _DEBUG */
> #pragma comment(lib,"msvcirt")
> #endif  /* _DEBUG */
> 
> #else   /* _DLL */
> #ifdef  _DEBUG
> #pragma comment(lib,"libcimtd")
> #else   /* _DEBUG */
> #pragma comment(lib,"libcimt")
> #endif  /* _DEBUG */
> #endif  /* _DLL */
> 
> #else   /* _MT */
> #ifdef  _DEBUG
> #pragma comment(lib,"libcid")
> #else   /* _DEBUG */
> #pragma comment(lib,"libci")
> #endif  /* _DEBUG */
> #endif
> 
> #endif  /* _USE_OLD_IOSTREAMS */
> 
> C:\Program Files\Microsoft Visual Studio .NET\Vc7\include>type
> use_ansi.h
> /***
> *use_ansi.h - pragmas for ANSI Standard C++ libraries
> *
> *       Copyright (c) 1996-2001, Microsoft Corporation. All rights
> reserved.
> *
> *Purpose:
> *       This header is intended to force the use of the appropriate ANSI
> *       Standard C++ libraries whenever it is included.
> *
> *       [Public]
> *
> ****/
> 
> 
> #if     _MSC_VER > 100
> #pragma once
> #endif
> 
> #ifndef _USE_ANSI_CPP
> #define _USE_ANSI_CPP
> 
> #ifdef _MT
> #if defined(_DLL) && !defined(_STATIC_CPPLIB)
> #ifdef _DEBUG
> #pragma comment(lib,"msvcprtd")
> #else   // _DEBUG
> #pragma comment(lib,"msvcprt")
> #endif  // _DEBUG
> 
> #else   // _DLL && !STATIC_CPPLIB
> #ifdef _DEBUG
> #pragma comment(lib,"libcpmtd")
> #else   // _DEBUG
> #pragma comment(lib,"libcpmt")
> #endif  // _DEBUG
> #endif  // _DLL && !STATIC_CPPLIB
> 
> #else   // _MT
> #ifdef _DEBUG
> #pragma comment(lib,"libcpd")
> #else   // _DEBUG
> #pragma comment(lib,"libcp")
> #endif  // _DEBUG
> #endif
> 
> #endif  // _USE_ANSI_CPP
> 
> 
> 
> 
> > -----Original Message-----
> > From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]
> > On Behalf Of Fons Rademakers
> > Sent: Wednesday, February 26, 2003 7:25 AM
> > To: Rene Brun
> > Cc: Axel Naumann; Heather Kelly; roottalk@pcroot.cern.ch
> > Subject: Re: [ROOT] ROOT 3.04.02 and Visual .Net
> > 
> > I've just install VC .NET on my XP vmware machine and will try to
> build
> > binaries using Matt's recipes. If successful we will distribute these
> > binaries too.
> > 
> > -- Fons
> > 
> > 
> > On Tue, 2003-02-25 at 22:10, Rene Brun wrote:
> > > Hi Axel, Heather, Matt and .NET fans,
> > >
> > > There is nothing wrong having a public discussion on this topic.
> > > I think that it is good to know that there are users looking
> > > to migration issues to .NET.
> > > I trust you to make a good investigation et propose solutions.
> > > We will include in the sources all changes that you will feel
> relevant
> > > once there is a consensus.
> > >
> > > Rene
> > >
> > >
> > > On
> > > Tue, 25
> > > Feb 2003, Axel Naumann
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I managed to build root with .NET without any problems; I didn't
> come
> > > > around testing whether linking VC6 libs within .NET works. So I
> have
> > not
> > > > had this problem because I've never tried it.
> > > >
> > > > Either way: The standard c++ lib for .NET and VC6 differ, so my
> > > > assumption would be (now, it wasn't a few weeks ago) that cross
> > linking
> > > > will only work when using the backward compatible .NET std lib -
> which
> > > > doesn't sound like a good idea, because that gives you the same
> buggy
> > > > lib people were fighting with under VC6.
> > > >
> > > > As Rene might not like a public discussion on this (it's not a bug
> > > > report as .NET is not supported, and .NET is so buggy that
> supporting
> > it
> > > > and adding 100 work-arounds won't really pay off), we should maybe
> > > > migrate it to a closed forum. Valeri: Have you seen this? Did you
> test
> > it?
> > > >
> > > > Either way, building root from sources with .NET instead of using
> the
> > > > binary distribution for VC6 should get rid of this problem.
> > > >
> > > > Cheers, Axel.
> > > >
> > > > Heather Kelly wrote:
> > > > > Hi,
> > > > >
> > > > > I have seen plenty of discussion concerning ROOT & Visual .Net -
> we
> > are
> > > > > using ROOT 3.04.02 on Windows.
> > > > > It was my understanding from previous posts that one could link
> > against
> > > > > the ROOT binaries compiled with VC6.
> > > > > However, we have run into trouble when compiling/linking (using
> > Visual
> > > > > .Net) our ROOT I/O classes against ROOT 3.04.02 (compiled with
> VC6),
> > > > > specifically related to TObject::SavePrimitive:
> > > > >
> > > > > mcRootData.arc(McPositionHit.obj) : error LNK2001: unresolved
> > external
> > > > > symbol "public: virtual void __thiscall
> TObject::SavePrimitive(class
> > > > > std::basic_ofstream<char,struct std::char_traits<char> > &,char
> > const
> > > > > *)"
> > > > >
> >
> (?SavePrimitive@TObject@@UAEXAAV?$basic_ofstream@DU?$char_traits@D@std@@
> @s
> > td
> > > > > @@PBD@Z)
> > > > >
> > > > >
> > > > > Clearly, others have not had this problem...is there a known
> cause
> > for
> > > > > this?  and is there an easy fix?
> > > > >
> > > > > Thanks,
> > > > > Heather
> > > >
> > --
> > Org:    CERN, European Laboratory for Particle Physics.
> > Mail:   1211 Geneve 23, Switzerland
> > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET