[comp.sys.apple2] external function calls in Pascal

acmfiu@serss0.fiu.edu (ACMFIU) (11/06/90)

I would like to combine some Pascal functions and procedures with an
Orca/C program. The variables would be declared in the Pascal routines
but I would like to access them from C. Would I do this with a "unit"?

albert

toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (11/06/90)

acmfiu@serss0.fiu.edu (ACMFIU) writes:

>I would like to combine some Pascal functions and procedures with an
>Orca/C program. The variables would be declared in the Pascal routines
>but I would like to access them from C. Would I do this with a "unit"?

Well, if that lets you access them from a seperately compiled piece of
pascal, then the linker should be able to match them to the C 'extern'
references.

Sorry I am not more specific but I am really rusty about Pascal (I avoided
it and FORTRAN like the plague since high school).

Todd Whitesel
toddpw @ tybalt.caltech.edu

jb10320@uxa.cso.uiuc.edu (Desdinova) (11/07/90)

In article <1620@kluge.fiu.edu> acmfiu@serss0.fiu.edu (ACMFIU) writes:
>I would like to combine some Pascal functions and procedures with an
>Orca/C program. The variables would be declared in the Pascal routines
>but I would like to access them from C. Would I do this with a "unit"?
>
>albert

Hi, it's me again.  Umm... first thing's first. You need to define prototypes
for the functions you want to call similar to this:

pascal int function(int a,float b,char *c);

Note the 'pascal' qualifier.
Also, you may or may not have to define the Pascal routines in question
inside a unit.  If the routines are Pascal library routines, then no
unit is required (Link will search the paslib).

BTW, what version of C do you have? I use file operations all the time and
have no problems.  You said you open a file, and it goes to the end.
Exactly what statements are you using to open the file (send me source code).

Also- why didn't you leave the program in pascal?
Also- did you say you have a pascal->C conversion program, or just a
      method?

--
Jawaid Bazyar               | Blondes in big black cars look better wearing
Senior/Computer Engineering | their dark sunglasses at night. (unk. wierdo)
jb10320@uxa.cso.uiuc.edu    |      The gin, the gin, glows in the Dark!
   Apple II Forever!        |                             (B O'Cult)
Comp.Sys.Apple2- Home of the Unofficial Apple II Developer Support Team (DST)

tribby@hpindwa.cup.hp.com (David Tribby) (11/07/90)

ART100@psuvm.psu.edu (Andy Tefft) writes:
>  ... I'm pretty sure the System Utilities which came with the //c
> can manipulate (read: convert) pascal and cp/m files too. 

Those utilities used to be shipped on the GS system disk, too. I've
moved quite a few text files from Pascal to ProDOS using the file
copier. 

--Dave