Connecting Tech Pros Worldwide Help | Site Map

Curiosity: C# and C++ in one assembly

  #1  
Old November 21st, 2008, 03:15 PM
Henri.Chinasque@googlemail.com
Guest
 
Posts: n/a
Hi all,

Just from a pure curiosity standpoint, would it be possible to have an
assembly with both c++ and c#? Google searches seem to hint at a "yes"
but I'm not so sure.

thanks,
HC
  #2  
Old November 21st, 2008, 04:05 PM
Ignacio Machin ( .NET/ C# MVP )
Guest
 
Posts: n/a

re: Curiosity: C# and C++ in one assembly


On Nov 21, 10:06 am, Henri.Chinas...@googlemail.com wrote:
Quote:
Hi all,
>
Just from a pure curiosity standpoint, would it be possible to have an
assembly with both c++ and c#? Google searches seem to hint at a "yes"
but I'm not so sure.
>
thanks,
HC
You cannot do it from VS, I'm not 100% sure than you cannot do it from
the command line. If yes it will not be trivial.

BTW, I assume you are talking about managed C++ right?
  #3  
Old November 21st, 2008, 04:25 PM
Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a

re: Curiosity: C# and C++ in one assembly


It should be noted that Jeremy's response is incorrect.

Assuming managed C++, you can compile one of your projects into a
netmodule (let's assume the C++ one to start). When compiling the C# code,
on the command line, you would use the /addmodule switch and reference the
C++ module, and it will be included in the assembly and its manifest.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

<Henri.Chinasque@googlemail.comwrote in message
news:b40be9ba-4995-42e0-aba1-7f79c192c43c@c36g2000prc.googlegroups.com...
Quote:
Hi all,
>
Just from a pure curiosity standpoint, would it be possible to have an
assembly with both c++ and c#? Google searches seem to hint at a "yes"
but I'm not so sure.
>
thanks,
HC

  #4  
Old November 21st, 2008, 11:25 PM
Ben Voigt [C++ MVP]
Guest
 
Posts: n/a

re: Curiosity: C# and C++ in one assembly




"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.comwrote in
message news:#Gux$T$SJHA.1172@TK2MSFTNGP03.phx.gbl...
Quote:
It should be noted that Jeremy's response is incorrect.
>
Assuming managed C++, you can compile one of your projects into a
netmodule (let's assume the C++ one to start). When compiling the C#
code, on the command line, you would use the /addmodule switch and
reference the C++ module, and it will be included in the assembly and its
manifest.
Also note that while they are then part of the same assembly for security
purposes, I believe they are still separate files (multiple-file assembly).

There is an ILMerge utility around somewhere that would generate a single
file, not sure if it is updated to support the latest .NET assembly format.
Quote:
>
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>
<Henri.Chinasque@googlemail.comwrote in message
news:b40be9ba-4995-42e0-aba1-7f79c192c43c@c36g2000prc.googlegroups.com...
Quote:
>Hi all,
>>
>Just from a pure curiosity standpoint, would it be possible to have an
>assembly with both c++ and c#? Google searches seem to hint at a "yes"
>but I'm not so sure.
>>
>thanks,
>HC
>
>
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Just out of curiosity: Which languages are they using at Google and what for? alainpoint@yahoo.fr answers 3 June 19th, 2006 04:15 PM
Need to add assembly reference to an ASP.NET page with XML/XSL transform Greg Collins [MVP] answers 5 November 18th, 2005 06:08 PM
Number of classes in the .NET Framework Mark answers 8 November 18th, 2005 11:25 AM
In which scope should variables be declared? elzacho answers 5 November 15th, 2005 03:31 AM