I have an application in managed C++, and a method in C# that I call. But now
I want to add the ability to tell the C# method a specific method in my C++
assembly to call back to. For example, to have the C++ call a sort routine in
C#, and send it a compare method, which the C## would call back to. I know
that within C# pointing to methods is done with delegates, but is it possible
between C++ and C#? Is there an example of this somewhere that anyone knows
of? Thanks for any help you can provide. 5 1666
Hi Richard,
Welcome to MSDN Newsgroup!
I hope the following articles are helpful for you,
Title: Using C calling convention callback functions in C# and VB - the
easy way
URL: http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp
Title: Delegates Tutorial - MC++ and C# - The dual perspective
URL: http://www.codeproject.com/managedcpp/csdeleg01.asp
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
-------------------- Thread-Topic: Delegate from C++ to C# thread-index: AcY8vySwZY6j6QVJS0qDqhdcP02TiA== X-WBNR-Posting-Host: 205.207.165.144 From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> Subject: Delegate from C++ to C# Date: Tue, 28 Feb 2006 15:31:47 -0800 Lines: 8 Message-ID: <A8**********************************@microsoft.co m> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.dotnet.general Path: TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189842 NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 X-Tomcat-NG: microsoft.public.dotnet.general
I have an application in managed C++, and a method in C# that I call. But
nowI want to add the ability to tell the C# method a specific method in my
C++assembly to call back to. For example, to have the C++ call a sort routine
inC#, and send it a compare method, which the C## would call back to. I know that within C# pointing to methods is done with delegates, but is it
possiblebetween C++ and C#? Is there an example of this somewhere that anyone
knowsof? Thanks for any help you can provide.
Thank you. The second article looks perfect, I will see what I can do with it.
""TerryFei"" wrote: Hi Richard, Welcome to MSDN Newsgroup!
I hope the following articles are helpful for you, Title: Using C calling convention callback functions in C# and VB - the easy way URL: http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp
Title: Delegates Tutorial - MC++ and C# - The dual perspective URL:http://www.codeproject.com/managedcpp/csdeleg01.asp
Best Regards,
Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security
--------------------Thread-Topic: Delegate from C++ to C# thread-index: AcY8vySwZY6j6QVJS0qDqhdcP02TiA== X-WBNR-Posting-Host: 205.207.165.144 From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> Subject: Delegate from C++ to C# Date: Tue, 28 Feb 2006 15:31:47 -0800 Lines: 8 Message-ID: <A8**********************************@microsoft.co m> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.dotnet.general Path: TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189842 NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 X-Tomcat-NG: microsoft.public.dotnet.general
I have an application in managed C++, and a method in C# that I call. But nowI want to add the ability to tell the C# method a specific method in my C++assembly to call back to. For example, to have the C++ call a sort routine inC#, and send it a compare method, which the C## would call back to. I know that within C# pointing to methods is done with delegates, but is it possiblebetween C++ and C#? Is there an example of this somewhere that anyone knowsof? Thanks for any help you can provide.
Hi Richard,
We are glad to know our information is helpful for you. It's my pleasure to
work with you. Thanks!
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
-------------------- Thread-Topic: Delegate from C++ to C# thread-index: AcY9SdMxjtwJBQw2QOSL5vwicxG5sQ== X-WBNR-Posting-Host: 205.207.165.144 From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> References: <A8**********************************@microsoft.co m>
<Wz**************@TK2MSFTNGXA03.phx.gbl>Subject: RE: Delegate from C++ to C# Date: Wed, 1 Mar 2006 08:04:31 -0800 Lines: 61 Message-ID: <FF**********************************@microsoft.co m> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.dotnet.general Path: TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189914 NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you. The second article looks perfect, I will see what I can do with
it. ""TerryFei"" wrote:
Hi Richard, Welcome to MSDN Newsgroup!
I hope the following articles are helpful for you, Title: Using C calling convention callback functions in C# and VB - the easy way URL: http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp
Title: Delegates Tutorial - MC++ and C# - The dual perspective URL:http://www.codeproject.com/managedcpp/csdeleg01.asp
Best Regards,
Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security
-------------------- >Thread-Topic: Delegate from C++ to C# >thread-index: AcY8vySwZY6j6QVJS0qDqhdcP02TiA== >X-WBNR-Posting-Host: 205.207.165.144 >From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> >Subject: Delegate from C++ to C# >Date: Tue, 28 Feb 2006 15:31:47 -0800 >Lines: 8 >Message-ID: <A8**********************************@microsoft.co m> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="Utf-8" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >Content-Class: urn:content-classes:message >Importance: normal >Priority: normal >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 >Newsgroups: microsoft.public.dotnet.general >Path: TK2MSFTNGXA03.phx.gbl >Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189842 >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 >X-Tomcat-NG: microsoft.public.dotnet.general > >I have an application in managed C++, and a method in C# that I call.
But now >I want to add the ability to tell the C# method a specific method in my C++ >assembly to call back to. For example, to have the C++ call a sort
routine in >C#, and send it a compare method, which the C## would call back to. I
know >that within C# pointing to methods is done with delegates, but is it possible >between C++ and C#? Is there an example of this somewhere that anyone knows >of? Thanks for any help you can provide. > >
Just a note to follow up in case anyone has a similar problem, I was able to
make a C++ program with a method in it, then call a C# function, sending in
the delegate to the method, and the C# called back to the C++ method.
Thanks again for the help.
""TerryFei"" wrote: Hi Richard, We are glad to know our information is helpful for you. It's my pleasure to work with you. Thanks!
Best Regards,
Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security
--------------------Thread-Topic: Delegate from C++ to C# thread-index: AcY9SdMxjtwJBQw2QOSL5vwicxG5sQ== X-WBNR-Posting-Host: 205.207.165.144 From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> References: <A8**********************************@microsoft.co m> <Wz**************@TK2MSFTNGXA03.phx.gbl>Subject: RE: Delegate from C++ to C# Date: Wed, 1 Mar 2006 08:04:31 -0800 Lines: 61 Message-ID: <FF**********************************@microsoft.co m> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.dotnet.general Path: TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189914 NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you. The second article looks perfect, I will see what I can do with it. ""TerryFei"" wrote:
Hi Richard, Welcome to MSDN Newsgroup!
I hope the following articles are helpful for you, Title: Using C calling convention callback functions in C# and VB - the easy way URL: http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp
Title: Delegates Tutorial - MC++ and C# - The dual perspective URL:http://www.codeproject.com/managedcpp/csdeleg01.asp
Best Regards,
Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security
-------------------- >Thread-Topic: Delegate from C++ to C# >thread-index: AcY8vySwZY6j6QVJS0qDqhdcP02TiA== >X-WBNR-Posting-Host: 205.207.165.144 >From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> >Subject: Delegate from C++ to C# >Date: Tue, 28 Feb 2006 15:31:47 -0800 >Lines: 8 >Message-ID: <A8**********************************@microsoft.co m> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="Utf-8" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >Content-Class: urn:content-classes:message >Importance: normal >Priority: normal >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 >Newsgroups: microsoft.public.dotnet.general >Path: TK2MSFTNGXA03.phx.gbl >Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189842 >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 >X-Tomcat-NG: microsoft.public.dotnet.general > >I have an application in managed C++, and a method in C# that I call. But now >I want to add the ability to tell the C# method a specific method in my C++ >assembly to call back to. For example, to have the C++ call a sort routine in >C#, and send it a compare method, which the C## would call back to. I know >that within C# pointing to methods is done with delegates, but is it possible >between C++ and C#? Is there an example of this somewhere that anyone knows >of? Thanks for any help you can provide. > >
Hi Richard,
You are welcome. Thanks!
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
-------------------- Thread-Topic: Delegate from C++ to C# thread-index: AcZCOXf/Nxnm/ZZOQpiUMKTzvwqQqA== X-WBNR-Posting-Host: 205.207.165.144 From: =?Utf-8?B?UmljaGFyZCBNU0w=?= <Ri*************@nospam.nospam> References: <A8**********************************@microsoft.co m>
<Wz**************@TK2MSFTNGXA03.phx.gbl>
<FF**********************************@microsoft.co m>
<AP**************@TK2MSFTNGXA03.phx.gbl>Subject: RE: Delegate from C++ to C# Date: Tue, 7 Mar 2006 14:50:02 -0800 Lines: 113 Message-ID: <0D**********************************@microsoft.co m> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 Newsgroups: microsoft.public.dotnet.general Path: TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:190365 NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 X-Tomcat-NG: microsoft.public.dotnet.general
Just a note to follow up in case anyone has a similar problem, I was able
tomake a C++ program with a method in it, then call a C# function, sending
inthe delegate to the method, and the C# called back to the C++ method.
Thanks again for the help.
""TerryFei"" wrote:
Hi Richard, We are glad to know our information is helpful for you. It's my pleasure
to work with you. Thanks!
Best Regards,
Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security
-------------------- >Thread-Topic: Delegate from C++ to C# >thread-index: AcY9SdMxjtwJBQw2QOSL5vwicxG5sQ== >X-WBNR-Posting-Host: 205.207.165.144 >From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> >References: <A8**********************************@microsoft.co m> <Wz**************@TK2MSFTNGXA03.phx.gbl> >Subject: RE: Delegate from C++ to C# >Date: Wed, 1 Mar 2006 08:04:31 -0800 >Lines: 61 >Message-ID: <FF**********************************@microsoft.co m> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="Utf-8" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >Content-Class: urn:content-classes:message >Importance: normal >Priority: normal >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 >Newsgroups: microsoft.public.dotnet.general >Path: TK2MSFTNGXA03.phx.gbl >Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189914 >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 >X-Tomcat-NG: microsoft.public.dotnet.general > >Thank you. The second article looks perfect, I will see what I can do
with it. > >""TerryFei"" wrote: > >> Hi Richard, >> Welcome to MSDN Newsgroup! >> >> I hope the following articles are helpful for you, >> Title: Using C calling convention callback functions in C# and VB -
the >> easy way >> URL: http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp >> >> Title: Delegates Tutorial - MC++ and C# - The dual perspective >> URL:http://www.codeproject.com/managedcpp/csdeleg01.asp >> >> Best Regards, >> >> Terry Fei [MSFT] >> Microsoft Community Support >> Get Secure! www.microsoft.com/security >> >> -------------------- >> >Thread-Topic: Delegate from C++ to C# >> >thread-index: AcY8vySwZY6j6QVJS0qDqhdcP02TiA== >> >X-WBNR-Posting-Host: 205.207.165.144 >> >From: "=?Utf-8?B?UmljaGFyZCBNU0w=?=" <Ri*************@nospam.nospam> >> >Subject: Delegate from C++ to C# >> >Date: Tue, 28 Feb 2006 15:31:47 -0800 >> >Lines: 8 >> >Message-ID: <A8**********************************@microsoft.co m> >> >MIME-Version: 1.0 >> >Content-Type: text/plain; >> > charset="Utf-8" >> >Content-Transfer-Encoding: 7bit >> >X-Newsreader: Microsoft CDO for Windows 2000 >> >Content-Class: urn:content-classes:message >> >Importance: normal >> >Priority: normal >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 >> >Newsgroups: microsoft.public.dotnet.general >> >Path: TK2MSFTNGXA03.phx.gbl >> >Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:189842 >> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 >> >X-Tomcat-NG: microsoft.public.dotnet.general >> > >> >I have an application in managed C++, and a method in C# that I
call. But >> now >> >I want to add the ability to tell the C# method a specific method in
my >> C++ >> >assembly to call back to. For example, to have the C++ call a sort routine >> in >> >C#, and send it a compare method, which the C## would call back to.
I know >> >that within C# pointing to methods is done with delegates, but is it >> possible >> >between C++ and C#? Is there an example of this somewhere that
anyone >> knows >> >of? Thanks for any help you can provide. >> > >> > >> >> >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Minh Khoa |
last post by:
Please give me more information about delegate and its usage?
Why do i use it and when?
|
by: ^MisterJingo^ |
last post by:
Hi all,
I've been trying to get my head around delegates. The book i'm using
had a single example, not much explaination, and didn't show how to set
up a delegate and pass variables in and out...
|
by: Jeff S |
last post by:
Please consider this sample code: It registers a delegate with an event.
p1.FirstNameChanged += new Person.NameChanged(p1_FirstNameChanged);
Now the following code removes the delegate:...
|
by: Ant |
last post by:
Hello,
Very simple question but one I need clarified.
Which part of the statement below is considered the 'delegate'?
Is it the 'new System.EventHandler'
or the
btnAccept_Click?
or is it...
|
by: David Veeneman |
last post by:
I have several events that pass a value in their event args. One event
passes an int, another a string, another a DateTime, and so on. Rather than
creating a separate set of event args for each...
|
by: Quimbly |
last post by:
I'm having some problems comparing delegates. In all sample projects I
create, I can't get the problem to occur, but there is definitely a problem
with my production code.
I can't give all the...
|
by: matsi.inc |
last post by:
I am looking to make something like a delegate that i can use in my
projects but am having a hard time getting started.
The behavior I am most interested in is how a delegate changes it's
Invoke...
|
by: damiensawyer |
last post by:
Hi,
Can someone please explain to me something about delegates?
My understanding is as follows. A delegate is basically an object that
can hold a reference to a "method" somewhere. That is,...
|
by: raylopez99 |
last post by:
Here is a good example that shows generic delegate types. Read this
through and you'll have an excellent understanding of how to use these
types. You might say that the combination of the generic...
|
by: vcquestions |
last post by:
Hi.
Is there way to have a function pointer to a delegate in c++/cli that
would allow me to pass delegates with the same signatures as
parameters to a method?
I'm working with managed code. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |