473,587 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Implementing C# Interfaces into a managed C++ Class?

my C# code interface:

namespace IShared;
{
public interface IChannelEntity
{
void SendMsg(string p_msg);
void Exit();
}
public interface IChannelEntityC allBack
{
[OneWay]
void RcvMsg(string p_msg);
}
}

I am trying to figure out how to implement my Interfaces into a c++ managed class. Here is what I got in my cpp file:

namespace EMRBridge
{
//gc managed c++ class
EMRBridge::EMRB ridge( )
{

}
void EMRBridge::Send Msg(IChannelEnt ity *EMR_IChannelEn tity, String *p_msg)
{
try {
EMR_IChannelEnt ity->SendMsg(p_msg) ;
}
catch (Exception* ex) {
Console::WriteL ine( ex->ToString( ) );
}
}

void EMRBridge::Rece iveMsg(IChannel EntityCallBack *rcv, String *p_msg)
{
try {
rcv->RcvMsg(p_msg );
}
catch(Exception * ex){
Console::WriteL ine( ex->ToString( ) );
}
}
}

I will have another question after this. Basically this interface I have is for a message router. The IChannelEntity and IChannelCallBac k are Interfaces. Did I code the functions right to accept an object and a string correctly? I have never written a managed c++ file that implements c# code interfaces.

my header:

// EMRBridge.h

#pragma once
#using <mscorlib.dll >
#using <System.dll>
#using <System.Runtime .Remoting.dll>

using namespace System;
using namespace System;
using namespace System::Data;
using namespace System::Xml;
using namespace System::Threadi ng;
using namespace System::Runtime ::Remoting::Ser vices;
using namespace MB;
using namespace IShared;

namespace EMRBridge
{
__gc class EMRBridge
{
public:
EMRBridge();

IShared::IChann elEntity *EMR_IChannelEn tity;

//Send Messages
public:
void SendMsg(IChanne lEntity *EMR_IChannelEn tity, String *p_msg);

//Receive Messages
public:
void ReceiveMsg(ICha nnelEntityCallB ack *rcv, String *p_msg);

};
}

_______________ ______
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #1
0 997

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
17187
by: mdc | last post by:
Hi, Is there any way to implement an interface as a static method in C#? If not, is this a bug? Micheal.
2
2314
by: Martin Zenkel | last post by:
Dear VS Team, using the Beta 2 of VS 2005 I've encontered the following problem. Let's assume threre are three Dll's, one unmanaged and two managed. In the unmanaged we put a simple unmanged struct "A" which is exported in the usual way. The first managed assembly defines a managed class "B" using the unmanaged class "A" defined in the...
4
3316
by: phl | last post by:
hi, My question is: 1. To avoid possible memory leaks, when you use this pattern, after you have dealth with the unmanaged resources and before you take your object off the finalize queue, how are you sure that your managed object resources are completely freed up of resources it's might be using? In my case below I have a private bool...
2
3428
by: DaTurk | last post by:
I have three interfaces, lets call them General, Client, Server. public interface General { public Value{get;} } public interface Client : General {}
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.