Great, thanks.
it. As I mentioned I read up on the .netmodule and some of that
documentation led me to believe it was possible. The part I was missing was
the /FU on the c++ compile. Since I didn't know about this I was not
understanding how the C++ code would be made aware of the C# classes. This
explains it (I hope). I'll give it a try.
makefiles. I'm not a big fan of Visual Studio. Unfortunately most others in
corresponds to the /FU flag.
remove "nospam" change community. to msn.com
""Walter Wang [MSFT]"" wrote:
> Thanks G Himangi for your informative input.
>
> Hi Nick,
>
> Here's a quick sample on how to achieve this (based on this blog
>
http://blogs.msdn.com/texblog/archive/2007/04/05/linking-native-c-into-c-app > lications.aspx, it's linking native c++ into C#, what we needed is the
> opposite but steps are similar):
>
>
> 1) Create a C++ file clrcode.cpp:
>
>
> using namespace System;
> using namespace ClassLibrary1;
>
> void main()
> {
> Class1^ c1 = gcnew Class1();
> c1->Test();
> }
>
>
>
> 2) Create a C# class class1.cs:
>
> using System;
> using System.Collections.Generic;
> using System.Text;
>
>
> namespace ClassLibrary1
> {
> public class Class1
> {
> public void Test()
> {
> Console.WriteLine("Test");
> }
> }
> }
>
>
> 3) Start VS2005 environment command prompt:
>
> csc /target:module Class1.cs
> cl /clr /LN /MD clrcode.cpp /FU Class1.netmodule
>
> link /LTCG /CLRIMAGETYPE:IJW /SUBSYSTEM:CONSOLE
> /ASSEMBLYMODULE:clrcode.netmodule /OUT:MixedApp.exe clrcode.obj
> Class1.netmodule
>
> MixedApp
>
>
> Hope this helps.
>
>
> Regards,
> Walter Wang (wawang@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>