In previous articles, Jun Nakamura introduced using regular function pointers, C++ class member function pointers, and declaring pointers to the members of classes. In this article, he writes about calling conventions, callback functions, and begins to talk about using functors.
There are many programming languages out there and a lot of them come with very useful libraries and APIs. It is possible to tie all these different libraries (coded in different languages) together in your main application.
Maybe you want to develop the user interface in Visual Basic, need a performance sensitive engine coded in C and C++ and have some legacy functionality of which nobody understands the implementation anymore running in Fortran. As you might have guessed, I have actually worked for a company that strung applications together that used libraries like these.
Different languages use different calling conventions because there are many ways to implement function calls on a computer. The main issue here is the order in which function parameters are passed to the function when it is called. These parameters are put onto the memory stack so that the function that is about to execute has access to them. The next issue is whether the caller or the called function will clean up these parameters.
Though I don’t want to go too deep into calling conventions, stacks etcetera, let me give you a small overview.