I need to create a .NET assembly composed of 2 modules: 1 internal (in the DLL) with native code and 1 external (in a .netmodule file).
This would be easy to do, except for the native part.
C#'s compiler can do this (this is what I want, but with native code):
csc /t:library /out:foobar.dll foo.cs /out:bar.netmodule bar.cs
-foobar.dll (contains assembly manifest and foo's IL)
-internal module foobar.dll (contains foo's IL)
-external module bar.netmodule (contains bar's IL)
C++ compiler/linker will put everything in 1 internal module.
cl /clr /LD foo.cpp /link bar.netmodule /LTCG
OR link /out:foobar.dll foo.netmodule bar.netmodule
-foo(bar).dll (contains IL for both foo and bar, as well as assembly manifest)
Assembly Linker only does external modules:
al /out:foobar.dll foo.netmodule bar.netmodule
-foobar.dll (only contains manifest)
-external module foo.netmodule (contains foo's IL)
-external module bar.netmodule (contains bar's IL)
I've also tried tweaking the IL manually, but ILDASM and ILASM don't appear able to round-trip the native code:
ildasm foobar.dll /out=foobar.il
ilasm /dll foobar.il
-lots of errors
For clarification, what I want is this:
-foobar.dll (contains assembly manifest and foo's IL AND NATIVE CODE)
-internal module foobar.dll (contains foo's IL AND NATIVE CODE)
-external module bar.netmodule (contains bar's IL)