HighTechTalks DotNet Forums  

Calling a C++/CLI dll function from an MFC dll/exe

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Calling a C++/CLI dll function from an MFC dll/exe in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mdosi
 
Posts: n/a

Default Calling a C++/CLI dll function from an MFC dll/exe - 10-28-2007 , 11:51 PM






Hi,

I have a C++/CLI dll that have some methods that I need to use (or call)
from my legacy C++ application/dll created using Visual Studio 6.0.

Will really appreciate some suggestions on what are some of the ways to do
the above so that I can call the functions I wrote in C++/CLI (Visual Studio
2005) from my legacy application.

THanks


Reply With Quote
  #2  
Old   
Sheng Jiang[MVP]
 
Posts: n/a

Default Re: Calling a C++/CLI dll function from an MFC dll/exe - 10-29-2007 , 02:08 PM






1 Create some callback function types
2 pass the pointer of your callback function in C++/CLI projects into your
MFC legacy application. Your callback function can call managed funtion in
the same project.

--
Sheng Jiang
Microsoft MVP in VC++
"Mdosi" <Mdosi (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I have a C++/CLI dll that have some methods that I need to use (or call)
from my legacy C++ application/dll created using Visual Studio 6.0.

Will really appreciate some suggestions on what are some of the ways to do
the above so that I can call the functions I wrote in C++/CLI (Visual
Studio
2005) from my legacy application.

THanks




Reply With Quote
  #3  
Old   
Andrew Faust
 
Posts: n/a

Default Re: Calling a C++/CLI dll function from an MFC dll/exe - 10-29-2007 , 08:46 PM



Can you upgrade to VS Net 2005? If so you can create a static class marked
unsafe that you can reference and call directly from your unmanaged code.
That static class can then call any other .Net code you need. I used this
method to build a Win32 dll wrapper around some .Net code for use in a
scripting language that could only call vanilla Win32 dlls.


--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com


"Sheng Jiang[MVP]" <sheng_jiang (AT) hotmail (DOT) com.discuss> wrote

Quote:
1 Create some callback function types
2 pass the pointer of your callback function in C++/CLI projects into
your
MFC legacy application. Your callback function can call managed funtion
in
the same project.

--
Sheng Jiang
Microsoft MVP in VC++
"Mdosi" <Mdosi (AT) discussions (DOT) microsoft.com> wrote in message
news:00CDED3A-4EFF-495C-AE53-9FAD1BA87D83 (AT) microsoft (DOT) com...
Hi,

I have a C++/CLI dll that have some methods that I need to use (or call)
from my legacy C++ application/dll created using Visual Studio 6.0.

Will really appreciate some suggestions on what are some of the ways to
do
the above so that I can call the functions I wrote in C++/CLI (Visual
Studio
2005) from my legacy application.

THanks





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.