Xref: utzoo comp.lang.c++:13497 comp.lang.c:39330 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ncar!noao!arizona!naucse!wew From: wew@naucse.cse.nau.edu (Bill Wilson) Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: Borland C products and MS Fortran Message-ID: <3741@naucse.cse.nau.edu> Date: 16 May 91 19:56:44 GMT References: <1991May15.210252.12062@beach.csulb.edu> Followup-To: comp.lang.c++ Organization: Northern Arizona University, Flagstaff AZ Lines: 109 From article <1991May15.210252.12062@beach.csulb.edu>, by sichermn@beach.csulb.edu (Jeff Sicherman): > > Microsoft Fortran supports interlanguage calling to their C and Pascal > (and assembler, of course) through use of interface statements and > declaration attributes. > > Do the object module formats and calling conventions of Boralnd's C > products permit linking the object files in the same manner. I assume > this is equiavalent to asking if the Borland C compilers can > produce MS compatible object modules for linking together. > There is no problem linking object files from these two compilers. I have done it using arrays and large memory models. The main thing that you need to know is the calling convention for the various models. The following examples should help: The following is the C source that produces n random numbers: #include #include #include void pascal inita(int far *n,int far *i); void pascal sort(int far *n,int far *i); main(argc,argv) int argc; char *argv[]; { long far *i,j,n; int now; if (argc-1==0){ fprintf(stderr,"You must include the count on the command line.\n"); exit(1); } n=atoi(argv[1]); printf("%ld bytes free\n",farcoreleft()); i=(long *)farcalloc(n,sizeof(long)); printf("%ld bytes free after I\n",farcoreleft()); if (i==NULL){ printf("Not enough room for allocation\n"); farfree(i); exit(1); } srand(time(&now)%37); inita(&n,i); printf("After init:\n"); for (j=0;j