Click here to Skip to main content
15,881,789 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have a software in c++ and a software in c#, I need to interface them..I search on google but I don't fine anything

What I have tried:

i search on internet but I don't find anything, do you have some examples? thanks
Posted
Updated 22-Feb-23 2:38am
v3
Comments
Fred van Lieshout 21-Feb-23 10:30am    
You could take a look at SWIG: https://www.swig.org/Doc3.0/CSharp.html
Dave Kreskowiak 21-Feb-23 10:50am    
That depends entirely on what you mean by "interface them". Are you trying to use a C++ library in a C# app? A C# library in a C++ app? Or whatever else. You're going to have to go into far more detail to get a reasonable answer.
Member 14594285 21-Feb-23 11:06am    
yes, I must use a c++ library in c# app
Member 14594285 22-Feb-23 4:10am    
sorry, it's the opposite..c# library for c++..sorry
[no name] 21-Feb-23 11:02am    
If you're not in a hurry, maybe transfer a file between them.

Quote:
I must use a c++ library in c# app
For a non-NET C++ Executable (EXE or DLL) you use the DllImportAttribute Class (System.Runtime.InteropServices) | Microsoft Learn[^]
 
Share this answer
 
See CodeProject example here: Calling All Stations[^]
 
Share this answer
 
Comments
Member 14594285 23-Feb-23 8:56am    
this example is the opposite...c# that calls c++ libraries, but I need c++ that calls c# libraries..thanks
Now that you've completely reverse the question, and still left out a lot of detail, about the best you're going to get is this: use c# dll in C++ - Google Search[^]

The quality of the answers you get is directly dictated by the quality of the question you ask.
 
Share this answer
 
v2
A c# class can expose itself as a COM Server:
C# code [^]

and, If all other methods do not work, you can always use the socket API for interoperability.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900