Connecting Tech Pros Worldwide Forums | Help | Site Map

Mixing Old/New Syntax?

Budde, Marco
Guest
 
Posts: n/a
#1: Dec 6 '06
We have developed a big library using managed C++. The project started
with .NET 1.0 and has been ported to .NET 1.1. Today we ship the library
compiled for .NET 1.1 and 2.0.

At the moment the whole code uses the "old" managed C++ syntax.
Due to the amount of code and the need of supporting .NET 1.1 it is
not possible for us to port the complete code to the new CLI/C++
syntax.

We would like to use the new Generics. We have written a Generic
class using the new syntax. After setting the property of this class in
the IDE to CLI/C++ is is possible to compile this class in the same project
as the other classes still using the old syntax.

But afterwards the real problem occurs. How can we use this new class
in classes, which are still using the old syntax? Including the header file
of the new class into old classes does not work (due to the mixture of
the new and the old syntax).

Is it possible to tell the compiler, which syntax a header files uses
(e.g. with a pragma)?

cu, Marco

Vladimir Nesterovsky
Guest
 
Posts: n/a
#2: Dec 6 '06

re: Mixing Old/New Syntax?


...
Quote:
We would like to use the new Generics. We have written a Generic
class using the new syntax. After setting the property of this class in
the IDE to CLI/C++ is is possible to compile this class in the same
project
as the other classes still using the old syntax.
>
But afterwards the real problem occurs. How can we use this new class
in classes, which are still using the old syntax? Including the header
file
of the new class into old classes does not work (due to the mixture of
the new and the old syntax).
>
Is it possible to tell the compiler, which syntax a header files uses
(e.g. with a pragma)?
If you shall separate new and old syntax classes into different assemblies,
you will be able to import that assemblies without having to include header
files. This will resolve the problem.

--
Vladimir Nesterovsky


Budde, Marco
Guest
 
Posts: n/a
#3: Dec 6 '06

re: Mixing Old/New Syntax?


Hi,
Quote:
If you shall separate new and old syntax classes into different
assemblies, you will be able to import that assemblies without having to
include header files. This will resolve the problem.
I know. But as a result I need all classes in one assembly. Is this not
possible?

cu, Marco

Bruno van Dooren [MVP VC++]
Guest
 
Posts: n/a
#4: Dec 6 '06

re: Mixing Old/New Syntax?


We would like to use the new Generics. We have written a Generic
Quote:
class using the new syntax. After setting the property of this class in
the IDE to CLI/C++ is is possible to compile this class in the same
project
as the other classes still using the old syntax.
Generics are a feature of .NET 2.0 and the new syntax.
Old syntax has no concept of generics, so whether you put your CLI classes
in another assembly, or simply mix old and new syntax in 1 project doesn't
matter.
Old syntax has no room for using generics.

--

Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"


William DePalo [MVP VC++]
Guest
 
Posts: n/a
#5: Dec 6 '06

re: Mixing Old/New Syntax?


"Budde, Marco" <mb-news-a@linuxhaven.dewrote in message
news:eX9kblSGHHA.1912@TK2MSFTNGP03.phx.gbl...
Quote:
Quote:
>If you shall separate new and old syntax classes into different
>assemblies, you will be able to import that assemblies without having to
>include header files. This will resolve the problem.
>
I know. But as a result I need all classes in one assembly. Is this not
possible?
That's a good question. I wonder if it is possible to create a netmodule
from the classes that use the old syntax and then to link that netmodule
with one that contains the new classes to form a complete assembly:

http://msdn2.microsoft.com/en-us/library/k669k83h.aspx

Regards,
Will


Budde, Marco
Guest
 
Posts: n/a
#6: Dec 7 '06

re: Mixing Old/New Syntax?


Hi Bruno,
Quote:
Generics are a feature of .NET 2.0 and the new syntax.
Old syntax has no concept of generics, so whether you put your CLI classes
in another assembly, or simply mix old and new syntax in 1 project doesn't
matter.
Old syntax has no room for using generics.
I have not problems creating instances of existing generic classes
using the old syntax, e.g.:

System::Collections::Generic::List<Value* *values;

There seems to be only one problem: using generic classes, which have
been defined in the same project using the new syntax.

cu, Marco

Closed Thread