473,608 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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::Crea teInstanceFrom 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
2 2310

<ke***********@ googlemail.comw rote in message
news:60******** *************** ***********@i3g 2000hsf.googleg roups.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::Crea teInstanceFrom 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
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::Crea teInstanceFrom 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
23652
by: Rudolf | last post by:
Is it possible to add a vb.net source code module to a c# project and if so how? Thanks Rudolf
0
2824
by: kaalus | last post by:
Hello I have problem mixing managed and unmanaged C++ code in VS.NET 2003. I want to create a windows forms application which uses some C++ code that is incompatible with managed extensions (__fastcall etc.). I have tried disabling "compile as managed" option for these specific files, but it does not help: by trial and error I figured out that if there are any "references" in the project, IDE adds /FU switch with each of these references to...
22
528
by: Alper AKCAYOZ | last post by:
Hello Esteemed Developers and Experts, I have been using Microsoft Visual C++ .NET for 1 year. During this time, I have searhed some topics over internets. Most of the topics about .NET is related to C# and Visual Basic .NET. There are less documents about Visual C++ .NET or Managed C++. I wonder the reasons of below questions: 1) Is C# more powerful than Managed C++ and Visual C++ .NET? 2) Is Microsoft intending to support C# and...
7
2441
by: Ekim | last post by:
hello, I'm using MANAGED C++ and need one of the following two questions answered: 1.) How can one make a global managed array? I'm thinking on something like defining static System::Byte globalArray __gc; at the begin of a file. But I get the error "global Array: cannot declare a global or static managed type object or a __gc pointer"
2
1293
by: BCC | last post by:
Hi, I have a need to read in a very simple xml file and initialized some objects from the data. I was reading on the ms website that .net contains its own XML parser, and it sounds pretty good for what I need. However, to use the code, it looks like I need to compile with managed extensions. Since my project does not use managed extensions, I am not sure what the ramifications are of using them in regards to performance.
1
1258
by: Steve Marsden | last post by:
Hi All the information I had read suggested that if you had an existing C project that you wished to change to managed code all you had to do was use the /clr switch and then over time you could convert/add managed code bit by bit. I have done this on my large C project and all compiles and links OK. So far so good.
3
1963
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the new format (compiling with /clr:OldSyntax): everything works and compiles fine. Unfortunately, I cannot link to the newly created DLL from any other application/DLL: LNK2019: unresolved external symbol. I've checked the DLL
2
5774
by: andy6 via DotNetMonster.com | last post by:
I took a c++ 6.0 project and converted it to c++ .net 2005 project. I want to make a web service out of it. One of the new files I created was a cpp where I have the webmethod pointing to a function in the previously 6.0 code and I get the error noted below. What I don't understand is since I created this cpp as a new file in .net and inherited from a .net base class then why would I get this error? Both the class and base class to me...
3
2181
by: frank | last post by:
Hi I've got aplication, which one is written in unmanaged c++ with stl, i've made for it gui in managed c++. Problem becomes when I'm starting to filling up for example datagrids, when I'm adding row to datagrid , some varibles (vectors etc) in unmanaged class are cleared or filled with null. I want mention also when i compile only unmanaged class for console project (without .net gui) problem never happends, everything works fine.
0
8050
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7987
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8472
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8130
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6805
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3954
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2464
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.