[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

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

Mdosi

10/29/2007 3:51:00 AM

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

2 Answers

Sheng Jiang

10/29/2007 6:08:00 PM

0

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@discussions.microsoft.com> wrote in message
news:00CDED3A-4EFF-495C-AE53-9FAD1BA87D83@microsoft.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
>


Andrew Faust

10/30/2007 12:47:00 AM

0

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.andre...


"Sheng Jiang[MVP]" <sheng_jiang@hotmail.com.discuss> wrote in message
news:%23fqNOblGIHA.3548@TK2MSFTNGP06.phx.gbl...
>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@discussions.microsoft.com> wrote in message
> news:00CDED3A-4EFF-495C-AE53-9FAD1BA87D83@microsoft.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
>>
>
>