Mixing C++/CLI and managed extensions for C++

K

kelvin.koogan

Our company has a mix of users with VS2003 & VS2005. I'm am having
difficulty working out how components written with these 2 tools can
be written together. I want to be able to a) incorporate a C++/CLI DLL
written in VS2005 into a managed extensions app written with VS2003
and b) use a managed extensions DLL written with VS2003 in a C++/CLI
app written in VS2005.

How can I do this?

Immediate problems I found:

1) If I try to include the header from a C++/CLI DLL in a managed
extensions app then it doesn't recognise the new syntax 'public ref
class'.

2) If I do Activator::CreateInstanceFrom on a C++/CLI DLL from a
managed extensions app then it throws a bad format exception.

3) If I try to include the header from a managed extensions DLL in a C+
+/CLI app then if doesn't like the old syntax 'public __gc class'
unless I turn on the oldsyntax switch which presumably means doing
everything with the old syntax.

Thanks for any help you can give.
KK
 
D

David Anton

I can't help you with a technical solutions, but... given the history of
Managed Extensions vs C++/CLI (i.e., that Managed Extensions were recognized
as a mistake by Microsoft and that they redesigned from scratch for C++/CLI),
you might want to consider just moving the 2003 code to 2005 as soon as
possible. There are bugs in 2003 that won't even be addressed since Managed
Extensions is abandoned (and rightly so).
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to Ruby
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
 
B

Ben Voigt [C++ MVP]

Our company has a mix of users with VS2003 & VS2005. I'm am having
difficulty working out how components written with these 2 tools can
be written together. I want to be able to a) incorporate a C++/CLI DLL
written in VS2005 into a managed extensions app written with VS2003
and b) use a managed extensions DLL written with VS2003 in a C++/CLI
app written in VS2005.

(a) = not happening. The VS2003 compiler can't understand the newer
assembly format, and you can't use COM because only one version of the CLR
can be loaded.

(b) Just add the old assembly as a managed reference, no header files are
involved.
 

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