By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,456 Members | 1,742 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,456 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jan 8 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a

<ke***********@googlemail.comwrote in message
news:60**********************************@i3g2000h sf.googlegroups.com...
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.
>
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

Jan 8 '08 #2

P: n/a
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
"ke***********@googlemail.com" wrote:
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
Jan 8 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.