Mixing Old/New Syntax?

  • Thread starter Thread starter Budde, Marco
  • Start date Start date
B

Budde, Marco

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
 
...
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.
 
Hi,
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
 
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.

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
(e-mail address removed)
Remove only "_nos_pam"
 
Hi Bruno,
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
 
Back
Top