migrating VC6 to VC8

T

Tony Johansson

Hello!!

You may correct me if I say something that is not right.

If I want to use the .NET framework for an VC6/MFC application I must
compile the VC6/MFC to VC8 using the /CLI switch after removing all the
errors?

The old MFC will work in the new VS2005(VC8)
My MFC project consist of several files that constitute the MFC application.

Now assume that I want to change something in the old updated MFC what
conditions exist then.
Can I use.NET framework only in new classes or is possible to use it even in
old classes from the updated MFC application?

I wrote in an earlier mail the following:
If I intend to use C++ in VS2005 I can either use managed code which
is C++/CLI which give me the possibility to mix other language such
as C# or VB or use unmanaged code for example using MFC then I can
not mix other language.

I received the answer below
There are two separate, somewhat independent issues:
1. Which platform you're targeting: native or managed
2. Which language (syntax) you're using: C++/CLI, ISO C++ or ISO C89.
C++/CLI - managed only
ISO C++ - native or managed (or mixture)
ISO C - native only

Supported languages can be mixed on either platform, so for example, you
can use both ISO C++ and C++/CLI to write managed code (but only the C++/CLI
classes will be usable from other .NET languages). In fact, there's nothing
to stop you from having C++/CLI, ISO C++ compiled as managed, ISO C++
compiled as natice and ISO C89 compiled as native all in the same
executable.


Some more question on the answer.You wrote which platform you're targeting:
native or managed?
I assume a managed app mean that it is more or less plattform independent
similar to Java
and that you can mix different .NET langauges. Is that right conclusion?

Even if you have a managed app you can't use it as you can use Java because
Java runs on most plattforms for example Unix..
If I use managed app which plattform can the updated app be executed on? Can
I run it on Unix(Linux)?
Is it a condition to be able to mix several different .NET langauges for an
application that it's a managed app?
A native app can't mix different .NET langauges?

If I instead used native what do I miss then?
Is it correct an updated app VC6/MFC to VC8 that will use the .NET framework
must be a managed app.?

If I update a VC6/MFC to VC8 just to be able to use .NET framework What
condition exist in the new updated application. I mean when changing
existing code in one way or another and adding new code. Can I use the
standard C++(ISO C++) instead of C++/CLI?. So the question is when can I use
standard C++(ISO C++) and when do I have to use C++/CLI in the updated
VC6/MFC to VC8 to be abler to use .NET framework.

//Tony
 
C

Carl Daniel [VC++ MVP]

Tony said:
Hello!!

You may correct me if I say something that is not right.

If I want to use the .NET framework for an VC6/MFC application I must
compile the VC6/MFC to VC8 using the /CLI switch after removing all
the errors?

If you wan to use .NET 2.0, yes. You can do it with VC 7.1 (2003) for .NET
1.1, but you won't have the new managed C++ syntax.
The old MFC will work in the new VS2005(VC8)
My MFC project consist of several files that constitute the MFC
application.

You may have to make a change here and there, by overall, yes.
Now assume that I want to change something in the old updated MFC what
conditions exist then.
Can I use.NET framework only in new classes or is possible to use it
even in old classes from the updated MFC application?

When you compile your existsing code with /clr, you can use .NET framework
classes from anywhere, including adding new code to old classes.
I wrote in an earlier mail the following:
If I intend to use C++ in VS2005 I can either use managed code which
is C++/CLI which give me the possibility to mix other language such
as C# or VB or use unmanaged code for example using MFC then I can
not mix other language.

I received the answer below
There are two separate, somewhat independent issues:
1. Which platform you're targeting: native or managed
2. Which language (syntax) you're using: C++/CLI, ISO C++ or ISO
C89. C++/CLI - managed only
ISO C++ - native or managed (or mixture)
ISO C - native only

Supported languages can be mixed on either platform, so for
example, you can use both ISO C++ and C++/CLI to write managed code
(but only the C++/CLI classes will be usable from other .NET
languages). In fact, there's nothing to stop you from having
C++/CLI, ISO C++ compiled as managed, ISO C++ compiled as natice and
ISO C89 compiled as native all in the same executable.


Some more question on the answer.You wrote which platform you're
targeting: native or managed?
I assume a managed app mean that it is more or less plattform
independent similar to Java
and that you can mix different .NET langauges. Is that right
conclusion?
Yes.

Even if you have a managed app you can't use it as you can use Java
because Java runs on most plattforms for example Unix..
If I use managed app which plattform can the updated app be executed
on? Can I run it on Unix(Linux)?

Maybe. The platform is the CLI. Microsoft .NET is one implementation of
the CLI, but there are others. The Mono project is an open-source CLI for
Unix, but it doesn't support everything that .NET supports yet. In practice
your WinForms+MFC app is still tied to Windows, just as it was as an MFC
app.
Is it a condition to be able to mix several different .NET langauges
for an application that it's a managed app?
No.

A native app can't mix different .NET langauges?

Yes it can, but not as easily.
If I instead used native what do I miss then?

Windows Forms and the .NET framework classes.
Is it correct an updated app VC6/MFC to VC8 that will use the .NET
framework must be a managed app.?

That's two ways of saying the same thing. .NET Framework app == managed
app.
If I update a VC6/MFC to VC8 just to be able to use .NET framework
What condition exist in the new updated application. I mean when
changing existing code in one way or another and adding new code. Can
I use the standard C++(ISO C++) instead of C++/CLI?. So the question
is when can I use standard C++(ISO C++) and when do I have to use
C++/CLI in the updated VC6/MFC to VC8 to be abler to use .NET
framework.

You never have to use C++/CLI. When interacting with the .NET framework,
you can use C++/CLI or the older Managed Extensions for C++. Use of ISO C++
and C++/CLI are not mutually exclusive - C++/CLI is an extension of ISO C++,
so you can write 99% ISO C++ and mix in a little bit of C++/CLI here and
there where you need to interact with .NET framework class.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top