[comp.lang.c] <-25@<kXtFgop@quack.sac.ca.us>>

doug@tisgate.tis.tandy.com (06/28/91)

/* Written 12:04 pm  Jun 22, 1991 by mantecan@quack.UUCP in tisgate:comp.lang.c */
/* ---------- "Calling TP functions from TC" ---------- */

 Hi.
  I have been told by a few people that it is impossible to call turbo
  pascal functions from turbo C, and a few others told me they thought
  you could do it, but wasn't sure.
   Please help, I'm pretty desperate in this situation, I have little to
   no knowledge of pascal, and this is one of those time where I can't
   use a pascal to C translator.
   If there is a way, does someone know how?
   Please help, and any help is GREATLY appreciated!!!

-- 
-----------------------------------------------------------------------
-   "Good night, God bless and kiss goodbye to the earth"             -
-                             - Elvis Costello                        -
-----------------------------------------------------------------------
-    Jai Braatz       mantecan@quack.sac.ca.us                        -
-----------------------------------------------------------------------
/* End of text from tisgate:comp.lang.c */

doug@tisgate.tis.tandy.com (06/28/91)

/* Written  5:38 pm  Jun 26, 1991 by doug@tisgate.tis.tandy.com in tisgate:comp.lang.c */

>   /* ---------- "Calling TP functions from TC" ---------- */

>    Hi.
>     I have been told by a few people that it is impossible to call turbo
>     pascal functions from turbo C, and a few others told me they thought
>     you could do it, but wasn't sure.
>      Please help, I'm pretty desperate in this situation, I have little to
>      no knowledge of pascal, and this is one of those time where I can't
>      use a pascal to C translator.
>      If there is a way, does someone know how?
>      Please help, and any help is GREATLY appreciated!!!

You may have figured this out by now but I'll send a message anyway.

You can simply declare the Pascal functions to be pascal functions.  If
you have a routine such as

  procedure foo(a:integer; var b:integer);

you could declare it in your C program as

  extern pascal void foo(int a, int *b);

You can also have C function compiled using Pascal style parameter
passing by using the -p option.  If you have any function in the
code that you keep with the C style parameter passing then use the
keyword 'cdelc' in the function declaration.  Notice that if you declare
a function to be a pascal routine then you cannot pass a variable number
of parameters to it as you can in C.

  Doug Scott