473,320 Members | 1,691 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,320 software developers and data experts.

Call C# from C++(unmanaged)

Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.
Jul 21 '05 #1
3 8967
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.

Jul 21 '05 #2
On 2005-03-30, jyotig <jy****@discussions.microsoft.com> wrote:
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.


Hmmm, the only thing I can think of is for you to host the runtime in
your process...

http://msdn.microsoft.com/library/de...ageruntime.asp

might be a good place to start :)
--
Tom Shelton [MVP]
Jul 21 '05 #3
Jyoti,

If you have C++ code with you then you can compile same C++ (Legacy)code
under VS .NET compiler with /Clr switch
Look for documentation here from MSDN :
http://msdn.microsoft.com/library/de...ompilation.asp

I tried achieve same goal last year and some of the steps I have documented
in my blog http://harishds.weblogs.us/archives/2004_04.html
Harish
"jyotig" wrote:
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.

Jul 21 '05 #4

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

Similar topics

4
by: Gnanaprakash Rathinam | last post by:
Hi Expert, Is there a way to obtain assembly name in an unmanaged call? During Interop call between managed to unmanaged, I would like to know in unmanaged code about the caller of assembly file...
3
by: rasa | last post by:
I am able to instantiate and make calls to a com module that use only primitive data types, but I simply don't know what the c# equivalent is for a function expecting short*. Any help would be...
24
by: Jazper | last post by:
hi i have this problem. i made a class deverted by CRootItem with implementation of IDisposable-Interface. i made a test-funktion to test my Dispose-Method.... but when set a breakpoint in my...
2
by: hykim | last post by:
I want to call a unmanaged dll's function returning some STRUCT's pointer. the next is definition of a STRUCT. ----------------------------------------------------------------------- typedef...
4
by: Andreas Ntalakas | last post by:
hello is it possible to call functions implemented in a C# .dll from unmanaged C++ code Thank you
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
0
by: Ken Durden | last post by:
A little more info. I have a unmanaged C++ DLL, compiled without /CLR. Inside a Managed C++ DLL, I have the following class: MarshalWrapper.h ---- #ifdef _MANAGED __nogc #endif
28
by: Peter Olcott | last post by:
I want to double check my understanding about how the .NET framework works. From what I understand every call to the .NET framework is ultimately translated into one of more API calls, is this...
1
by: lingchen_email | last post by:
Hi, Is there a way to call an API in unmanaged DLL from C# application in a way that the name of the API is generated programmatically? For example, I have API_AAA(p1,p2) & API_BBB(p1,p2,p3)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.