473,322 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C++/CLI only way to use C++ for .NET?

Hi,

I am working on a small fun programming project (AntMe if anyone knows
it) which provides code examples for C# and Visual Basic 2005

After doing some programming with C#, I was going to try to write a
library for it with C++ too.
I never worked with .NET before only with plain C++ so I tried to find
some information about it. The only thing I found on the net are
references to Managed C++ and its successor C++/CLI.

Did I interpret the information I found on the net correctly that there
is no way to programm a .NET compatible assembly without the CLI syntax
extensions (or said in a different way, just by using only the C++
standard language)?
If so that confuses me a little since I've also found various sources
stating that C++ was a .NET compatible language. But from my knowledge
C++ and C++/CLI are not the same language but have some fundamental
differences.

Any information or a good link about this topic (Just googling for
C++/CLI and .NET didn't help much, too many (and unhelpful) results)
would be appreciated

Thanks
Apr 18 '07 #1
3 1217
Andreas Schmitt wrote:
Hi,

I am working on a small fun programming project (AntMe if anyone knows
it) which provides code examples for C# and Visual Basic 2005

After doing some programming with C#, I was going to try to write a
library for it with C++ too.
I never worked with .NET before only with plain C++ so I tried to find
some information about it. The only thing I found on the net are
references to Managed C++ and its successor C++/CLI.

Did I interpret the information I found on the net correctly that there
is no way to programm a .NET compatible assembly without the CLI syntax
extensions (or said in a different way, just by using only the C++
standard language)?
If so that confuses me a little since I've also found various sources
stating that C++ was a .NET compatible language. But from my knowledge
C++ and C++/CLI are not the same language but have some fundamental
differences.

Any information or a good link about this topic (Just googling for
C++/CLI and .NET didn't help much, too many (and unhelpful) results)
would be appreciated
Andreas:

In VS2005 you must use C++/CLI to target the .NET framework. You cannot
do it with standard C++.

--
David Wilkinson
Visual C++ MVP
Apr 18 '07 #2
I am working on a small fun programming project (AntMe if anyone knows
it) which provides code examples for C# and Visual Basic 2005

After doing some programming with C#, I was going to try to write a
library for it with C++ too.
I never worked with .NET before only with plain C++ so I tried to find
some information about it. The only thing I found on the net are
references to Managed C++ and its successor C++/CLI.

Did I interpret the information I found on the net correctly that there
is no way to programm a .NET compatible assembly without the CLI syntax
extensions (or said in a different way, just by using only the C++
standard language)?
If so that confuses me a little since I've also found various sources
stating that C++ was a .NET compatible language. But from my knowledge
C++ and C++/CLI are not the same language but have some fundamental
differences.

Any information or a good link about this topic (Just googling for
C++/CLI and .NET didn't help much, too many (and unhelpful) results)
would be appreciated
Hi,

C++/CLI is a superset of C++, just like C++ itself is a superset of C.
C++ is still a native only language. C++/CLI allows you to write .NET apps,
as well as apps that mixe native code and .NET code in the same module.

Managed C++ is the predecessor to C++/CLI. It is dead -rightfully so I might
add- and will be all but a bad dream in the near future.

There is an interesting rationale behind a lot of the C++/CLI design
decisions that can be found here: www.gotw.ca/publications/C++CLIRationale.pdf
It is written by Herb Sutter, the main man behind the C++ front end.

--
Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Apr 19 '07 #3
Any information or a good link about this topic (Just googling for C++/CLI
and .NET didn't help much, too many (and unhelpful) results) would be
appreciated
..NET assemblies carry metadata that is required for other .NET languages to
use the types and functions inside. This metadata is created only when the
C++/CLI extended syntax is used. For example, .NET requires every type to
be marked as either pass-by-value (stack and embedded variables) or
pass-by-reference (garbage collected), and native C++ syntax doesn't
indicate to the compiler which you desire.

So:
(1) The only C++ compiler capable of writing out a .NET assembly is
currently MS Visual C++ using the /clr format.
(2) /clr works with ISO standard C++ programs (commonly called native C++)
to produce .NET assembly files, but these will be missing the metadata, so
the .NET assembly cannot be usefully referenced by any other .NET program
(even C++).
(3) Using C++/CLI keywords such as "ref class" provides the compiler with
the additional information needed to produce the metadata. It also subjects
those parts of your code to the additional constraints placed on .NET types
(single inheritance, for instance).
Apr 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.