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

Curiosity: C# and C++ in one assembly

P: 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
Nov 21 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Nov 21, 10:06 am, Henri.Chinas...@googlemail.com wrote:
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?
Nov 21 '08 #2

P: n/a
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]
- mv*@spam.guard.caspershouse.com

<He*************@googlemail.comwrote in message
news:b4**********************************@c36g2000 prc.googlegroups.com...
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

Nov 21 '08 #3

P: n/a


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:#G**************@TK2MSFTNGP03.phx.gbl...
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.
>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<He*************@googlemail.comwrote in message
news:b4**********************************@c36g2000 prc.googlegroups.com...
>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

Nov 21 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.