RE: Linking Mixed Mode and Managed Assemblies
- From: ignhenry <ignhenry@xxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 04:51:04 -0700
Hi Jeffrey, thanks for the reply. I tried the examples and it works.
I finally managed to do the linking using VC++ linker. With it, I am able to
get smaller number of assemblies (One DLL and 2 .NET modules). I just can't
figure out how to achieve that with Al.exe (If you have any ideas, please let
me know).
In essence:
1. csc /out:Proj1_CSharp.netmodule /target:module
/recurse:..\src\Proj1_CSharp\*.cs
2. cl /clr /LN /MD /D "WITH_ATLAS" ..\src\Proj2_MCPP\*.cpp libf77blas.lib
libatlas.lib /I "../External/ATLAS" /AI "../External/ATLAS" /link
/LIBPATH:"../External/ATLAS" /OUT:"Kernel.netmodule"
3. csc /addmodule:Proj1_CSharp.netmodule;Kernel.netmodule
/out:Numeric.netmodule /target:module /recurse:..\src\Numeric\*.cs
4. link /LTCG /CLRIMAGETYPE:IJW /NOENTRY /DLL
/ASSEMBLYMODULE:Proj1_CSharp.netmodule /ASSEMBLYMODULE:Kernel.netmodule
/OUT:Proj3_CSharp.dll Numeric.netmodule /LIBPATH:"C:\Program Files\Microsoft
Visual Studio 8\VC\" /LIBPATH:"../External/ATLAS"
---> output 1 dll and 2 netmodules
Henry
""Jeffrey Tan[MSFT]"" wrote:
Hi Henry,.
I have compiled the following files in a single .NET assembly (which is not
the same as a single file as you know that a .NET assembly is a logical
grouping of .NET modules):
csc /t:module /out:Proj1_CSharp.net Proj1_CSharp.cs
cl -clr -LN Proj2_MCPP.cpp
csc /t:module /addmodule:Proj1_CSharp.net /addmodule:Proj2_MCPP.netmodule
Proj3_CSharp.cs
al /out:single.dll /platform:x86 Proj1_CSharp.net Proj2_MCPP.netmodule
Proj3_CSharp.netmodule
Proj3_CSharp.cs:
public class Proj3_CSharp
{
public void f(Proj2_MCPP x, Proj1_CSharp y)
{
}
}
Proj2_MCPP.cpp:
#using "Proj1_CSharp.net"
public ref class Proj2_MCPP
{
public:
void g(Proj1_CSharp x) {}
};
Proj1_CSharp.cs:
public class Proj1_CSharp
{
public void h(){}
}
single.dll is a manifest-only file of a .NET assembly with 3 .NET modules
Proj1_CSharp.net, Proj2_MCPP.netmodule and Proj3_CSharp.netmodule.
Depending on what you have in the C++ code -most likely- you will need a
manifest file for the .EXE consuming types defined in the
Proj2_MCPP.netmodule.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- RE: Linking Mixed Mode and Managed Assemblies
- From: "Jeffrey Tan[MSFT]"
- RE: Linking Mixed Mode and Managed Assemblies
- References:
- RE: Linking Mixed Mode and Managed Assemblies
- From: "Jeffrey Tan[MSFT]"
- RE: Linking Mixed Mode and Managed Assemblies
- Prev by Date: how to create a new window after pressing a buttom in a diglog??
- Next by Date: Re: Porting from 32 bit Windows server 2008 to 64 bit Windows Server 2008
- Previous by thread: RE: Linking Mixed Mode and Managed Assemblies
- Next by thread: RE: Linking Mixed Mode and Managed Assemblies
- Index(es):
Loading