Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  93 Posts | 1 Stories | 336 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

In my last blog we saw how to create netmodule any code in .net. Today we well see that how we can use it in an application. So for the implementation of the netmodule in my code I would like to show you a little Managed C++ application that easily consumed it.
 
// HelloWorld.h
#using <mscorlib.dll>
#using "CSharpHelloWorld.netmodule"
 
using namespace System;
 
// This code wraps the C# class using Managed C++
public __gc class HelloWorldC
{
public:
      CSharpHelloWorld __gc *t; // Provide .NET interop and garbage collecting to the pointer.
 
      HelloWorldC() {
            t = new CSharpHelloWorld(); // Assign the reference a new instance of the constructor.
      }
 
      void callCSharpHelloWorld() {
            t->displayHelloWorld();
      }
};
 
Note:-
            You get the CSharpHelloWorld class code from my last blog post. Where you also find the command how to create netmodule. For successfully run the above code you need to place the CSharpHelloWorld.netmodule and CSharpHelloWorld.dll in the same folder of Managed C++ application output folder because netmodule always required its respective .dll file for running.
posted on Tuesday, November 11, 2008 6:38 PM

Feedback

# re: How to use .Net Netmodule in C++ 1/2/2009 7:52 PM müzik
thank you.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: