calling from non-net C++ DLL to .net DLL and back 
Author Message
 calling from non-net C++ DLL to .net DLL and back

------  ------   ------
|Main|<-|C++ |<- |C#  |
|App |->|DLL |-> |DLL |
------  ------   ------

I'm dealing with an application I didn't write, which loads my C++ DLL.  The
C++ DLL is built using a heavily modified VS6, such that I can use regular
C++ libraries, but I cannot migrate this application to VS.net.

Now I want to hook into a C# DLL I've written so that the C++ DLL can load
and call my C# DLL, and the C# DLL can call back to C++ for various
information.

What's the best way to do this?  Do I need to create a mixed-mode C++.net
DLL in between to make this happen?  Can C# provide a COM interface to
outsiders?

Given any particular method, what are the steps to accomplish that?



Tue, 31 May 2005 05:55:36 GMT  
 calling from non-net C++ DLL to .net DLL and back
Alan,

Quote:
> I'm dealing with an application I didn't write, which loads my C++ DLL.
The
> C++ DLL is built using a heavily modified VS6, such that I can use regular
> C++ libraries, but I cannot migrate this application to VS.net.

> Now I want to hook into a C# DLL I've written so that the C++ DLL can load
> and call my C# DLL, and the C# DLL can call back to C++ for various
> information.

> What's the best way to do this?  Do I need to create a mixed-mode C++.net
> DLL in between to make this happen?

You could do that, but it would be complex in your case. Your second
question is actually spot on on what I'd suggest. Look for COM-Interop in
the documentation and read up on the tlbexp.exe tool that comes with the
.NET framework.

--
Tomas Restrepo



Tue, 31 May 2005 09:38:14 GMT  
 calling from non-net C++ DLL to .net DLL and back
Turns out we were not able to create a COM server on the C++ side, so we can
only go one way with COM.  It's an issue of compiler settings being
incompatible.



Quote:
> Alan,

> > I'm dealing with an application I didn't write, which loads my C++ DLL.
> The
> > C++ DLL is built using a heavily modified VS6, such that I can use
regular
> > C++ libraries, but I cannot migrate this application to VS.net.

> > Now I want to hook into a C# DLL I've written so that the C++ DLL can
load
> > and call my C# DLL, and the C# DLL can call back to C++ for various
> > information.

> > What's the best way to do this?  Do I need to create a mixed-mode
C++.net
> > DLL in between to make this happen?

> You could do that, but it would be complex in your case. Your second
> question is actually spot on on what I'd suggest. Look for COM-Interop in
> the documentation and read up on the tlbexp.exe tool that comes with the
> .NET framework.

> --
> Tomas Restrepo




Sun, 05 Jun 2005 06:03:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using a COM object in .NET that calls back to the invoking .NET class

2. Instability when calling a C++ DLL from VB.NET

3. Creating C# DLL to be used by non .NET application

4. VC6 DLL calls VB6 DLL calls back to VC6 DLL: Occasional GPF or ‘Bad DLL calling convention'

5. Port C++ .NET Project back C++ 6.0 :: Visual Studio

6. .NET project locking/loading DLL created by other .NET project

7. .NET project locking/loading DLL created by other .NET project

8. How to call VB.net and ASP.net programs in MFC?(or,asp call vc)

9. call .NET class from VC++ 6.0 DLL

10. How to call VB.net dll functions.

11. Call Back Functions call from within a DLL

12. DLL call in CE.NET (eVC++4)

 

 
Powered by phpBB® Forum Software