DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 22 Jul 2007 14:24:02 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Debasish Bose, Oracle Corp


COM Interop for Out Proc C++ Server from C#   
I have a legacy C++ realtime appwhich is being wrapped in a out of process 
COM server - fooServer. Now the IDL has four interfaces which are all 
dispinterfaces. Two of them are shown -

[ uuid(FAD83C4D-7AB7-4a23-B03B-3A1339C4E68B) ]
dispinterface IfooSettings
{
   methods:
  [id(1), helpstring("method loadSettings")] 
  HRESULT loadSettings([in]BSTR buffer, [out]VARIANT_BOOL* ret);

  ...
};

[ uuid(CC6CE3E0-466D-43e9-8CD3-799A44F60166) ]
dispinterface IfooEventCallback
{
  methods:
   [id(1),helpstring("method SetExtCallStateEventCallback")] 
   HRESULT  SetfooEventDelegate([in]_Delegate* cb);

   ...
};

The server is being created as a MFC CCmdTarget way. The IfooEventCallback 
ideally should be a classic COM style event interface but it is not. 

Now I have created a C# COM Interop dll by tlbimp. The generated interfaces 
seem just fine. Infact I am able to create "CoClass Interfaces" from C# 
triggering the fooServer.exe up - 

_fooEventCallback = new fooEventCallback();
            
_fooSettings = new fooSettings();

but just when I am invoking any methods on _fooSettings interface following 
get exception get dumped - 

Error Occured while application start: Internal application error. 
Source: SIPXSE~1
Trace:    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, 
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& 
msgData)

Strangely enough this doesn't happen for _fooEventCallback. Also I'm unable 
to debug even using two different instances of VS.NET one launching the 
client, other attached with fooServer.exe with all symbols loaded. Also when 
trying setting breakpoint, "source, binary mismatch" happens resulting 
breakpoints go erratic. I checked that PDBs are up-to-date. Could it be for 
heavy MACRO usage in the MFC app?

Also is it ok to have HRESULT as return type for methods of a dispinterface. 
Other than performance penalty in IDispatch::Invoke, is there anything wrong? 
Are C# COM Interop does well with such dispinterfaces other than events?

Anyway any pointer on this would be seriously appreciated as I'm stuck on 
this for a while.
Date:Sun, 22 Jul 2007 14:24:02 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us