Using a C# interface in a idl file.

R

rollasoc

In C#

I have the following in a file in a DLL on its own. Which is registered
from Com Interop

public interface IOpenCloseSomething
{

bool Open();

bool Close();

}

This allows me to create a reference in my C++ DLL and get my class to
implement this interface. This works fine. (using Visual C++ .Net ATL
project).

However what I actually want to do is in my C++ DLL have an interface
defined that uses IOpenCloseSomething as a parameter in function.

e.g

interface ITestingInterop : IDispatch{

[id(1), helpstring("method SendSomething")] HRESULT
SendSomething([out,retval] IOpenCloseSomething* OpenCloseSomethingObject);

};

The midl compiler complains of undefined symbol IOpenCloseSomething

How can I import my C# dll into my idl.

Ideally I'd like to implement a new interface in the C++ idl derived (and
thus extending) the original C# interface.

I've tried using importlib in the library section, but that didn't help me
use my interface. (I repeated this with importing a COM library built in
C++ and had the same problem until I imported the library's idl into my idl
and set up appropriate paths). Though importlib didn't cause an error.

Do I need to convert the C# interface file to an idl file (and then hand
implement a .h file to get the C++ project to compile)?

Any tips?

Rollasoc
PS Yes this should have been, and has been posted in the interop group, but
after 24 hours and no further forward I thought I'd open it up to the gurus
in the general newsgroup, (who possibly don't frequent the interop group).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top