Visual Basic

What's Required for Using MLP?

To use mixed languages on a development project you need competent developers, the right tools (that's all the tools, with debuggers and profilers included, of course) and you need a very good reason; in other words, what do these other languages offer you that you think you need? For example, if your reason is speed or general performance, consider whether a different language will really fix your problems before selecting one. Are you sure that you're using the right algorithm and that it's implemented in the most efficient way possible? Perhaps you should profile your application to make sure that you're focused on the right piece of code, and always do some back-of-the-envelope calculations to ascertain whether you can use your base language in a better way before reaching for some other. After all, it's easier and cheaper to change your existing code using languages you're familiar with than to add to the code using one that's perhaps more alien. However, if you must, and if all else fails, go for it!

I hope you're using Visual Studio, because there are a few languages to choose from-Visual Basic (Visual B++-you did read the last sidebar didn't you?), Visual C++, Visual J++, Visual InterDev, and last, but by no means least, Microsoft's Macro Assembler (MASM 6.1-what, you mean you didn't know it was on your CD?). Who among you has already spotted the deliberate mistake? Please forgive me for omitting Visual FoxPro-I simply know absolutely nothing about it! Of course, MLP should also allow you to exploit fully your chosen platform and your developer skills.

NOTE
Strictly speaking, a discussion on MLP in Visual Studio should perhaps also mention DHTML, HTML, ASP, SQL, and stored procedures (there, now I've done it!) and whatever else you can think of. Again, because of my personal ignorance, I'm afraid that, just like Visual FoxPro, I've had to omit them. Sorry!

How Is MLP Possible in Windows?

One of the truly great and-it must be said-often overlooked features about Windows is the fact that the linkage mechanism (the means by which components connect to one another) is not necessarily defined at the level of the linker. More frequently it's defined at the level of the operating system itself. Throughout the rest of this chapter, linkage defined "early" (by the linker) is referred to as "static linking," while linking defined "late" (by the operating system) is called "dynamic linking." Dynamic linking is at the heart of why MLP is possible in Windows.

You can perform MLP in Windows one of three ways:

  • By statically linking object modules that are created using different languages

  • By dynamically linking to a "straight" DLL

  • By dynamically linking with a COM object

These three approaches are explained in the following sections.