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

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:#Gux$T$SJHA.1172@xxxxxxxxxxxxxxxxxxxxxxx
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]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

<Henri.Chinasque@xxxxxxxxxxxxxx> wrote in message news:b40be9ba-4995-42e0-aba1-7f79c192c43c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: question-- a little confused
    ... put class Driver alone in Driver.java and just compile ... You should put these classes in separate files. ... If you think you have such a reason, ...
    (comp.lang.java.programmer)
  • Re: Touble with Win32-API-0.41
    ... I was able to compile the code below by simply running 'gcc itoa.c'. ... (Removing the leading ... matches in 7 separate files including libcrtdll.a, ...
    (comp.lang.perl.modules)
  • Re: Including C# file in a VC++.NET project
    ... Here is how you can build a dll from two different code netmodules ... // compile as cs file that calls into a cpp code module; ... > netmodule, at least I have not been able to figure this out. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Integrating VB 2005 module.
    ... Assuming you know where the netmodule is at compile time, ... If you are talking about a module file, then you will have to compile ... it to a netmodule (you can use the command line VB compiler to do this) and ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Mixing and matching languages.
    ... You could always compile the code as a netmodule ... that using a DLL is generally the better way to go, ... I need to make changes to the VB app ...
    (microsoft.public.dotnet.languages.csharp)