Join 300,404 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,611 people online right now. Registration is fast and FREE... Join Now!
I have googled this topic before, but I haven't come up with many answers on if using multiple languages will slow a program or have any effect. My question is simply if a single program could utilize different languages.
For example (odd, but someone could have a need to), use assembly to test hardware, C# for sockets, and C++ for GUI.
Would you have to make a smaller program as a launcher for the satellite programs, or could they just be linked together somehow?
For example (odd, but someone could have a need to), use assembly to test hardware, C# for sockets, and C++ for GUI.
You could do that, but why would you want to?
It depends on what you mean, but in general, yes, it's possible to mix languages within a single program. In fact, if you count using a library written in one language from another, then the vast majority of programs actually do this. It's also possible to embed interpreters for other languages, run separate executables written in another language, and various other things. It all depends on the languages and environment you're talking about.
My experience with multiple languages would be to write a function or functionality in the language that you know best, compile it as a DLL, & it is now distributable & able to be used with whatever language you want to write the Front End in.
This was usually the case when a buddy of mine, & me would collaborate on projects. I would write functionality in C or ASM & compile it as a DLL, & then he would work on the front end in VB6 (it was years ago) & we'd be up & running in half the time.
I've developed several applications that use multiple languages.
A good example would be my DLL injector, it had a native injection DLL written in C++ that my C# GUI would utilise. Worked great and really simple to use, saves having to find a way to inject DLLs with C#
I remember as a project for school we had to put java swing gui's on our C routines. I can't for the life of me remember what the java library was called that linked the C routines to the Java code though.
Well it seems very feasible to me now, but how did all of you link the libraries together? I know now that C# just uses .NET, but what about other languages?
Well it seems very feasible to me now, but how did all of you link the libraries together? I know now that C# just uses .NET, but what about other languages?
If you're writing something native such as C/C++ then you can just "extern" the methods and import them like any other native call from C#, DllImport.
Using functionality written in different languages is quite common and happens all the time. When I was a kid I programmed in QBasic and then used assembly to extend -- later I used C to help build a graphics library for it.
I have written several Java extension in C++ and just for fun I have called java functions from C (IMO that is a strange way to go... but it works).
Generally one builds up to an application so writing assembly, and C/C++ routines for C# is a natural progression.
You CAN use C# functions form C++ (esp. VC++) but like calling java functions from C its just a little odd...
Point is -- Yes you can write heterogeneous applications and in point of fact it is done very often.