473,412 Members | 3,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

how can i call C# method in c++ code?

Hi!

Can anyone tell me how can i call C# method in c++ code?

Thanks in advance!

Regards
Abhijit

Nov 7 '06 #1
3 5070

<ku**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
| Hi!
|
| Can anyone tell me how can i call C# method in c++ code?
|
| Thanks in advance!
|
| Regards
| Abhijit
|

You can't call a C# method from C++, at least not directly. You have two
options to call into managed code from unmanaged C++:
1. you expose your classs/methods as COM interfaces to be consumed by your
vc++ COM client, that is, you use COM interop.
2. You create a mixed native/managed C++ wrapper class using VS2005's
C++/CLI.
Detailed info can be found on MSDN, search for "C++ interop".

Willy.

Nov 7 '06 #2
Hi Willy,

Thank you very much for your reply.I will go through the MSDN "C++
interop".

Regards
Abhijit
Willy Denoyette [MVP] wrote:
<ku**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
| Hi!
|
| Can anyone tell me how can i call C# method in c++ code?
|
| Thanks in advance!
|
| Regards
| Abhijit
|

You can't call a C# method from C++, at least not directly. You have two
options to call into managed code from unmanaged C++:
1. you expose your classs/methods as COM interfaces to be consumed by your
vc++ COM client, that is, you use COM interop.
2. You create a mixed native/managed C++ wrapper class using VS2005's
C++/CLI.
Detailed info can be found on MSDN, search for "C++ interop".

Willy.
Nov 7 '06 #3

<ku**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi!

Can anyone tell me how can i call C# method in c++ code?
The much shorter answer is: compile your C++ files with /clr.
>
Thanks in advance!

Regards
Abhijit

Nov 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
0
by: Eugene Safrankow | last post by:
Hello All! I've encountered with the error when I call a method of dependency library (written in managed VC++) from Smart Client placed on a web page. In general, I make a call to the Windows...
9
by: keith | last post by:
I created a class libery which has name space Assembly and class Assembly and compiled it. Then created a C# project and called a method in the external class e.g. Assembly dll;...
8
by: ThomasR | last post by:
I understand that virtual methods on inherited objects are slower than non-virtual methods because of the indirection required to support the call. However, when looking at IL code produced by...
13
by: jac | last post by:
Hae, I have a windows form with a ComboBox an other things. On that combobox I have an eventhandler on de selectedindexchanged. But somewhere in my code want to do excecute the same code that...
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
9
by: Steve Richter | last post by:
in a generic class, can I code the class so that I can call a static method of the generic class T? In the ConvertFrom method of the generic TypeConvert class I want to write, I have a call to...
2
by: jojoba | last post by:
Hello to all! I have a fairly simple webservice running in asp.net ajax under c# (vs 2008). I built the service and it runs just dandy when i test it by itself in visual studio. However, to...
5
by: RP | last post by:
I have a function to fill combo box items. I pass SQL query and combo box name as arguments. This function is located in another class. In my Form, I have declared a delegate to this function...
29
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.