[comp.lang.c] C PASCAL INTERFACE

vtran@cod.NOSC.MIL (Viet D. Tran) (03/21/91)

I have programs that were written in two different languages, Pascal
and C.  Now, I am having trouble combining them together, or linking
them in the compiling process (using either Pascal or C compiler) to
make only one executable file.  If anyone knows how to do mixed language
programs with Pascal and C (such as C and In Line Assembly), or has any
other suggestions, please let me know.  Thanks.      

sjs@gnv.ifas.ufl.edu (03/22/91)

In article <2941@cod.NOSC.MIL>, vtran@cod.NOSC.MIL (Viet D. Tran) writes:
> 
> I have programs that were written in two different languages, Pascal
> and C.  Now, I am having trouble combining them together, or linking
> them in the compiling process (using either Pascal or C compiler) to
> make only one executable file.  If anyone knows how to do mixed language
> programs with Pascal and C (such as C and In Line Assembly), or has any
> other suggestions, please let me know.  Thanks.      

I have no trouble doing this with Microsoft C and Pascal.  Just make sure
there is only one main program; all the other routine files must be sub-
procedures or sub-functions.  Also make sure that they are compiled to the
same size (compact, small, large, etc.).

You left out a lot of info (compilers, op systems, etc.).  Try a small
program (like MAIN.PAS and a called SUB_FUNC.C) and see what happens.


 +---------------------------------------------+------------------------------+
 |     ~~~     Sid Sachs                       | "Time to wake up!            |
 |   / \ ~~~   at the Mountains of Madness     |    Time to rise!"            |
 |  /  / \                                     |                              |
 | /  /   \    Bitnet:    sjs@ifasgnv          | - Silver Lady,               |
 |   /     \   Internet:  sjs@gnv.ifas.ufl.edu |   Intergalactic Touring Band |
 +---------------------------------------------+------------------------------+

ts@uwasa.fi (Timo Salmi) (03/22/91)

In article <2941@cod.NOSC.MIL> vtran@cod.NOSC.MIL (Viet D. Tran) writes:
>
>I have programs that were written in two different languages, Pascal
>and C.  Now, I am having trouble combining them together, or linking

See Olhsen & Stoker, Turbo Pascal Advanced Techniques, Que, 1989.

...................................................................
Prof. Timo Salmi        
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

bobb@vice.ICO.TEK.COM (Bob Beauchaine) (03/23/91)

In article <1991Mar21.115923.88@gnv.ifas.ufl.edu> sjs@gnv.ifas.ufl.edu writes:
>
>I have no trouble doing this with Microsoft C and Pascal.  Just make sure
>there is only one main program; all the other routine files must be sub-

 Don't forget the other fine details, like making sure all of the C
 functions use the Pascal calling convention, and that you don't call
 any C library routines, and that you don't have any global static
 declared data in the C routine (unless you've got Turbo 6.0) and...

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 

Bob Beauchaine bobb@vice.ICO.TEK.COM 

C: The language that combines the power of assembly language with the 
   flexibility of assembly language.

seth@wet.UUCP (Seth Olitzky) (03/30/91)

In article <2941@cod.NOSC.MIL> vtran@cod.NOSC.MIL (Viet D. Tran) writes:
>
>I have programs that were written in two different languages, Pascal
>and C.  Now, I am having trouble combining them together, or linking
>them in the compiling process (using either Pascal or C compiler) to
>make only one executable file.  If anyone knows how to do mixed language
>programs with Pascal and C (such as C and In Line Assembly), or has any
>other suggestions, please let me know.  Thanks.      

A lot depends on what compilers and target machine you are using.  Borland
pascal TPU are not compatible with Borland C objects.  You will need to 
have two compilers from the same vendor such as the Microsoft C and Pascal
compiler or possible the Jensen (JPI) family of compilers.

Be very careful when using library calls as this can pull in lots of stuff.
The problem with mixing code is that you might pull in identical functions
from two different libraries and create an unnecessarily large program.
.

-- 
-----------------------------------------------------------------------------
Seth Olitzky             seth@wet
         ...!sun!hoptoad!wet!seth
----------------------------------------------------------------------------