.NET code integration with other languages

fkheng

Centurion
Joined
May 8, 2003
Messages
155
Location
Malaysia
Is it possible for me to use .NET language to create a system, which can then also include a separate module that uses C++ (not .NET, the old one)?

What must I do?
 
You can mix them in separate projects, not within the same project. Each project would be a separate DLL (Class Library project type) and use it's own language. The main EXE could also be whatever .NET language you wanted.

-Ner
 
so how do i link the4se separate dlls to the main exe? or how do these DLL files of different languages communicate with each other, if trhat is possible?
 
You add DLLs references through your project's References. In the solution explorer, you right click References and click Add. Locate the DLL and select it. Now that namespace and any classes in it can be instantiated (well, public ones and such).

You can also put all the projects together in one solution. If you have one project open, you can right click the solution node (the topmost entry in the solution explorer) and click Add. You can then add a new project or an existing one. Once added, go to the references and click add but this time click on the Project tab - it will show all the projects in the current solution. Now that namespace and any classes in it can be instantiated (well, public ones and such).

-Nerseus
 
Of course that's assuming the unmanaged C++ DLL (as was requested above) is using COM, and can be exposed in that fashion. If it's not using COM you'll have to invoke its methods using platform invoke.

I don't understand why you'd bother to do this though, since you can recompile the unmanaged C++ code into managed C++ code without changing a single character using the /clr compiler switch.
 
AND using a C++ dll with the managed dll will cause you all sorts of problems. Its nowhere near as easy as it sounds (in my opinion and experience!!!)
 
Back
Top