Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Basically my code is looks like below

Managed.dll
Managed.cs
C#
class MyManagedClass
{
public ShowMessage()
{
System.out.println("My Message");
}
}


Wrapper.dll

C++
ref class Wrapper
{

};



Native.lib
C++
class NativeClass
{
public:
void NativeMessage()
{
cout<<"Print Message";
}

}

Main

C++
void main
{
NativeClass ob;
ob.NativeMessage();
}

my issue is whenever the "ob.NativeMessage();" called, some how MyManagedClass::ShowMessage() has to be triggered.

And more impotent Native.lib linked in Wrapper.dll and Wrapper.dll referenced in Managed.dll.

Can any one help me on this.
Posted
Updated 17-Nov-14 6:22am
v2
Comments
sorawit amorn 17-Nov-14 11:00am    
Do you have an issue on how to implement ? or are you not able to call managed code in c++\cli ?

1 solution

It is an easy task. Look at this code from Microsoft.

You could ofcourse use your dll and function.
 
Share this answer
 
Comments
ravijmca 17-Nov-14 12:23pm    
Sorry I've missed to add one thing, Actually Native.lib linked in Wrapper.dll and Wrapper.dll referenced in Managed.dll.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900