Connecting Tech Pros Worldwide Forums | Help | Site Map

implement unmanaged interface

=?Utf-8?B?QmFqaS4=?=
Guest
 
Posts: n/a
#1: Nov 14 '07
Hi,

Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my main
application.

Thanks,
Baji.

Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 14 '07

re: implement unmanaged interface


Baji,

You can't. It has to be a COM interface, or a managed interface written
in C++/CLI. Otherwise, you have to implement it in C++ and then call into
managed code.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Baji." <Baji@discussions.microsoft.comwrote in message
news:1FFFD9DB-030C-4299-BF6B-4C030604B265@microsoft.com...
Quote:
Hi,
>
Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.
>
Thanks,
Baji.

=?Utf-8?B?QmFqaS4=?=
Guest
 
Posts: n/a
#3: Nov 14 '07

re: implement unmanaged interface


Yes,

It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.

can you suggest me something here?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Quote:
Baji,
>
You can't. It has to be a COM interface, or a managed interface written
in C++/CLI. Otherwise, you have to implement it in C++ and then call into
managed code.
>
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>
"Baji." <Baji@discussions.microsoft.comwrote in message
news:1FFFD9DB-030C-4299-BF6B-4C030604B265@microsoft.com...
Quote:
Hi,

Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.
>
>
>
Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#4: Nov 14 '07

re: implement unmanaged interface


Baji,

If it is a COM interface, you should be able to add a reference (on the
COM tab) to that dll (or the type library that stores the interfaces) and
VS.NET will generate managed representations of the interface for you.

Or, if you want to do this by hand, you can use the TLBIMP utility that
comes with the framework.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Baji." <Baji@discussions.microsoft.comwrote in message
news:EE24BB0D-8934-45EB-9635-0E7282EDDE78@microsoft.com...
Quote:
Yes,
>
It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.
>
can you suggest me something here?
>
"Nicholas Paldino [.NET/C# MVP]" wrote:
>
Quote:
>Baji,
>>
> You can't. It has to be a COM interface, or a managed interface
>written
>in C++/CLI. Otherwise, you have to implement it in C++ and then call
>into
>managed code.
>>
>--
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>>
>"Baji." <Baji@discussions.microsoft.comwrote in message
>news:1FFFD9DB-030C-4299-BF6B-4C030604B265@microsoft.com...
Quote:
Hi,
>
Can somebody suggest me, how can I implement a vc++ interface in
C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.
>
Thanks,
Baji.
>>
>>
>>

=?Utf-8?B?QmFqaS4=?=
Guest
 
Posts: n/a
#5: Nov 15 '07

re: implement unmanaged interface


Nicolas,

I am able to add the dll as a reference & also I have derived my class from
the interface. & the DEV env has also added the interface structure etc., to
my code. Now the interface method :CallMe() need to be called by my unmanaged
application. So, how can I achieve this ?

I am usinng VS 2008. After compilation am putting the dll into GAC & also
registering the tlb

I never get a break on the interface method. I think I am not doing in the
right way, can you suggest me ?

Thanks,
Baji.


"Nicholas Paldino [.NET/C# MVP]" wrote:
Quote:
Baji,
>
If it is a COM interface, you should be able to add a reference (on the
COM tab) to that dll (or the type library that stores the interfaces) and
VS.NET will generate managed representations of the interface for you.
>
Or, if you want to do this by hand, you can use the TLBIMP utility that
comes with the framework.
>
>
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>
"Baji." <Baji@discussions.microsoft.comwrote in message
news:EE24BB0D-8934-45EB-9635-0E7282EDDE78@microsoft.com...
Quote:
Yes,

It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.

can you suggest me something here?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Quote:
Baji,
>
You can't. It has to be a COM interface, or a managed interface
written
in C++/CLI. Otherwise, you have to implement it in C++ and then call
into
managed code.
>
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>
"Baji." <Baji@discussions.microsoft.comwrote in message
news:1FFFD9DB-030C-4299-BF6B-4C030604B265@microsoft.com...
Hi,

Can somebody suggest me, how can I implement a vc++ interface in
C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.
>
>
>
>
>
>
Closed Thread