I have a c#.NET class having an Event signature which is exposed to COM using an outgoing interface like this::
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IHehServerEvents
{
string EmptyEvent(object sender, CustomEventArgs args);
}
In PluginAPI.h>> I have
class PluginAPI: public IHehServerEvents,public FB::JSAPIAuto//implemented the COM outgoing interface
{
//declared EmptyEvent method based upon tlh file
HRESULT __stdcall EmptyEvent(VARIANT sender,IUnknown * args, BSTR * pRetVal);
FB_JSAPI_EVENT(CSharpEvent, 2, (FB::variant,IUnknown *));
}
HRESULT ClassCpluss::EmptyEvent(BSTR message, BSTR * pRetVal)
{....}
My Event helper in Firebreath statement is
FB_JSAPI_EVENT(CSharpEvent, 2, (VARIANT,struct _EventArgs *));
I also saw THIS link. SO boost::vairant is supported right?Then how to cast VARIANT to boost::variant? Any changes expected in the above statement? How to handle the above event in c# by use of VARIANT or struct?any examples would be helpful..
No, boost::variant is not supported, FB::variant is supported -- it is not the same thing at all. FB::variant is actually using boost::any internally.
What you're trying to do is mix COM and FireBreath and it's not going to have a good result. Instead, create a class that talks to your COM stuff and use that from your JSAPI object. Handle the event in your object and have it call a functor (look at boost::bind and boost::function) or maybe use signals and sockets from boost. There are lots of ways you can handle it, but the key here is that you need to first get your C++ object that knows how to talk to COM and then using that object from FireBreath will be easy. Directly using a VARIANT or arbitrary struct type with firebreath events will never work.