root@carme (Operator) (12/14/89)
I was hoping if someone has any experience with the following:
I want to link a C(Borland Turbo C) routine with a
BASIC routine under Microsoft 3.3
For exmaple, you have the following simple code:
main()
{
basic_sub()
}
which calls a subroutine written in BASIC.
Does the C compiler use the same calling
convention as the BASIC? I'm not much of an
expert on BASIC, or is it the case that the two compilers
use different conventions(e.g., arguments are in
different places, or results are expected in
different places).
rob@prism.TMC.COM (12/14/89)
>I want to link a C(Borland Turbo C) routine with a >BASIC routine under Microsoft 3.3... >Does the C compiler use the same calling >convention as the BASIC? I'm not much of an >expert on BASIC, or is it the case that the two compilers >use different conventions... There are things you need to watch out for, but it can be done without too much trouble. As you suspected, BASIC and C use different calling conventions, but many newer compilers (of both languages) let you modify the calling convention on a function-by-function basis, which makes it relatively simple for different languages to communicate. The best reference I've seen on this subject is a Microsoft document called the 'Mixed-Language Programming Guide'. It covers everything you need to know to make this work. Trouble is, the only way I know of getting it is to buy a Microsoft compiler. I don't know if Borland publishes something similar. The Microsoft document obviously deals with Microsoft products, but Turbo C and Microsoft C are very similar in terms of calling convention, segment setup, etc., so most of what you read about one should apply to the other.